GithubHelp home page GithubHelp logo

forestmodel's People

Contributors

niknakk avatar shixiangwang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

forestmodel's Issues

Error with person-period data

forestmodel v 0.6.2

Model:

mod <- coxph(Surv(tstart, exit_init, event_init) ~ DM1 + race_recode + ethnicity_recode + par_educ_high_gmc:tstart + par_income_grouped + paralc_recode + case_ctrl + par_separ12 + par_separ13up + CENTER + birth_cohort + mdd + sad + pd + agor + si + adhd_inatt + adhd_hyper12 + adhd_hyper13_15 + adhd_hyper16up + odd + cd12 + cd13_15 + cd16up + cig13 + cig14_15 + cig16up + mj12 + mj13up + frailty(FAM_ID), data = person_period)

Using forest_model

forest_model(coxph2b)

Error:
Error in [.default(data[, 1], , "time") : subscript out of bounds

When I run the model without the person-period format, the function generates a plot. However, I need to use the person_period plot to incorporate time-varying covariates.

Are there any solutions?

How to set limits and ticks

Dear author,

When I set the limits, I find the plot is incorrect.

image

And I want to know how to set custom ticks.

Best,
Shixiang

Error occurs when applying stratification on Cox models

It is very common to apply stratification on Cox models. In the survival package, the "strata" argument is available in the "coxph" function. However, since the update of the package to CRAN, it returns an error when attempting to plot coxph objects which have utilized the strata function.

Example:

library(survival)
library(forestmodel)
data(lung)
fit <- coxph(Surv(time, status)~ age + strata(sex), data=lung)
forest_model(fit)
Error: could not find function "strata"

Any suggestions how to solve this?

Best regards

Layout depends on RStudio windows size

Hey everyone, I am creating a forestplot using the code at the bottom (I know a lot doesn't make sense for the lung data set, but I didn't wanna change to much). I also attached two screenshots. I ran the code using RStudio once with a maximized window and once with a very small one. The middle lane seems to change it's size depending on the window size. I think this shouldn't happen. Anyway to avoid this?

library(survival)
library(forestmodel)

uni_cols <- c("ph.ecog", "ph.karno", "pat.karno", "meal.cal", "wt.loss")

uni_formulas <- sapply(uni_cols,
                       function(x) as.formula(paste("Surv(time, status) ~ ", x)))

uni_models <- lapply(uni_formulas, function(x) {coxph(x, data = lung)})

uni_fm <- forest_model(model_list = uni_models,
                       merge_models = TRUE,
                       show_global_p = "aside",
                       format_options = forest_model_format_options(
                         colour = "black",
                         color = NULL,
                         shape = 15,
                         text_size = 4,
                         point_size = 4,
                         banded = TRUE
                       ))

ggsave("data/plots/covs/forest_uni_test.png",
       width = 21,
       height = 14.8,
       units = "cm")

forest_uni_big
forest_uni_small

forest_model doesn't show interactions in Cox PH models

Dear Authors,
I noticed, that the forest_model function doesn't plot interactions. The version from CRAN doesn't do that, so I downloaded and installed the most fresh code from the GitHub. Same result. Is this by design to show only the main effects?

Expected behavior

Interaction effects should be shown

Actual behavior

Only the main effects are shown

Steps to reproduce the problem

Fit any Cox model with an interaction.
Run forest_model ()on it.

> forest_model( fit <- coxph(Surv(time, status) ~ ph.karno * age, data=lung))
Resized limits to included dashed line in forest panel
> summary(fit, conf.int = FALSE)
Call:
coxph(formula = Surv(time, status) ~ ph.karno * age, data = lung)

  n= 227, number of events= 164 
   (1 observation deleted due to missingness)

                   coef  exp(coef)   se(coef)      z Pr(>|z|)  
ph.karno     -0.1211782  0.8858761  0.0486092 -2.493   0.0127 *
age          -0.1206758  0.8863212  0.0610426 -1.977   0.0481 *
ph.karno:age  0.0016586  1.0016600  0.0007525  2.204   0.0275 *
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Concordance= 0.598  (se = 0.025 )
Likelihood ratio test= 14.52  on 3 df,   p=0.002
Wald test            = 13.42  on 3 df,   p=0.004
Score (logrank) test = 13.44  on 3 df,   p=0.004

obraz

session_info()

- Session info ---------------------------------------------------------------
 setting  value                       
 version  R version 4.0.2 (2020-06-22)
 os       Windows 10 x64              
 system   x86_64, mingw32             
 ui       Rgui                        
 language (EN)                        
 date     2020-09-29                  

- Packages -------------------------------------------------------------------
 package     * version   date       lib source                               
 abind         1.4-5     2016-07-21 [1] CRAN (R 4.0.0)                       
 assertthat    0.2.1     2019-03-21 [1] CRAN (R 4.0.2)                       
 backports     1.1.10    2020-09-15 [1] CRAN (R 4.0.2)                       
 broom         0.7.0     2020-07-09 [1] CRAN (R 4.0.2)                       
 callr         3.4.4     2020-09-07 [1] CRAN (R 4.0.2)                       
 car           3.0-9     2020-08-11 [1] CRAN (R 4.0.2)                       
 carData       3.0-4     2020-05-22 [1] CRAN (R 4.0.0)                       
 cellranger    1.1.0     2016-07-27 [1] CRAN (R 4.0.2)                       
 cli           2.0.2     2020-02-28 [1] CRAN (R 4.0.2)                       
 colorspace    1.4-1     2019-03-18 [1] CRAN (R 4.0.2)                       
 cowplot       1.1.0     2020-09-08 [1] CRAN (R 4.0.2)                       
 crayon        1.3.4     2017-09-16 [1] CRAN (R 4.0.2)                       
 curl          4.3       2019-12-02 [1] CRAN (R 4.0.2)                       
 data.table    1.13.0    2020-07-24 [1] CRAN (R 4.0.2)                       
 desc          1.2.0     2018-05-01 [1] CRAN (R 4.0.2)                       
 devtools      2.3.2     2020-09-18 [1] CRAN (R 4.0.2)                       
 digest        0.6.25    2020-02-23 [1] CRAN (R 4.0.2)                       
 dplyr         1.0.2     2020-08-18 [1] CRAN (R 4.0.2)                       
 ellipsis      0.3.1     2020-05-15 [1] CRAN (R 4.0.2)                       
 fansi         0.4.1     2020-01-08 [1] CRAN (R 4.0.2)                       
 farver        2.0.3     2020-01-16 [1] CRAN (R 4.0.2)                       
 forcats       0.5.0     2020-03-01 [1] CRAN (R 4.0.2)                       
 foreign       0.8-80    2020-05-24 [1] CRAN (R 4.0.2)                       
 forestmodel * 0.6.2     2020-09-29 [1] Github (NikNakk/forestmodel@dd8eb55) 
 fs            1.5.0     2020-07-31 [1] CRAN (R 4.0.2)                       
 generics      0.0.2     2018-11-29 [1] CRAN (R 4.0.2)                       
 ggplot2     * 3.3.2     2020-06-19 [1] CRAN (R 4.0.2)                       
 ggpubr      * 0.4.0     2020-06-27 [1] CRAN (R 4.0.2)                       
 ggsignif      0.6.0     2019-08-08 [1] CRAN (R 4.0.2)                       
 glue          1.4.2     2020-08-27 [1] CRAN (R 4.0.2)                       
 gridExtra     2.3       2017-09-09 [1] CRAN (R 4.0.2)                       
 gtable        0.3.0     2019-03-25 [1] CRAN (R 4.0.2)                       
 haven         2.3.1     2020-06-01 [1] CRAN (R 4.0.2)                       
 hms           0.5.3     2020-01-08 [1] CRAN (R 4.0.2)                       
 km.ci         0.5-2     2009-08-30 [1] CRAN (R 4.0.2)                       
 KMsurv        0.1-5     2012-12-03 [1] CRAN (R 4.0.0)                       
 knitr         1.30      2020-09-22 [1] CRAN (R 4.0.2)                       
 labeling      0.3       2014-08-23 [1] CRAN (R 4.0.0)                       
 lattice       0.20-41   2020-04-02 [1] CRAN (R 4.0.2)                       
 lifecycle     0.2.0     2020-03-06 [1] CRAN (R 4.0.2)                       
 magrittr      1.5       2014-11-22 [1] CRAN (R 4.0.2)                       
 Matrix        1.2-18    2019-11-27 [1] CRAN (R 4.0.2)                       
 memoise       1.1.0     2017-04-21 [1] CRAN (R 4.0.2)                       
 munsell       0.5.0     2018-06-12 [1] CRAN (R 4.0.2)                       
 openxlsx      4.2.2     2020-09-17 [1] CRAN (R 4.0.2)                       
 pillar        1.4.6     2020-07-10 [1] CRAN (R 4.0.2)                       
 pkgbuild      1.1.0     2020-07-13 [1] CRAN (R 4.0.2)                       
 pkgconfig     2.0.3     2019-09-22 [1] CRAN (R 4.0.2)                       
 pkgload       1.1.0     2020-05-29 [1] CRAN (R 4.0.2)                       
 prettyunits   1.1.1     2020-01-24 [1] CRAN (R 4.0.2)                       
 processx      3.4.4     2020-09-03 [1] CRAN (R 4.0.2)                       
 ps            1.3.4     2020-08-11 [1] CRAN (R 4.0.2)                       
 purrr         0.3.4     2020-04-17 [1] CRAN (R 4.0.2)                       
 R6            2.4.1     2019-11-12 [1] CRAN (R 4.0.2)                       
 Rcpp          1.0.5     2020-07-06 [1] CRAN (R 4.0.2)                       
 readxl        1.3.1     2019-03-13 [1] CRAN (R 4.0.2)                       
 remotes       2.2.0     2020-07-21 [1] CRAN (R 4.0.2)                       
 rio           0.5.16    2018-11-26 [1] CRAN (R 4.0.2)                       
 rlang         0.4.7     2020-07-09 [1] CRAN (R 4.0.2)                       
 rprojroot     1.3-2     2018-01-03 [1] CRAN (R 4.0.2)                       
 rstatix       0.6.0     2020-06-18 [1] CRAN (R 4.0.2)                       
 scales        1.1.1     2020-05-11 [1] CRAN (R 4.0.2)                       
 sessioninfo   1.1.1     2018-11-05 [1] CRAN (R 4.0.2)                       
 stringi       1.5.3     2020-09-09 [1] CRAN (R 4.0.2)                       
 stringr       1.4.0     2019-02-10 [1] CRAN (R 4.0.2)                       
 survival    * 3.2-3     2020-06-13 [1] CRAN (R 4.0.2)                       
 survminer   * 0.4.8.999 2020-09-29 [1] Github (kassambara/survminer@acff36f)
 survMisc      0.5.5     2018-07-05 [1] CRAN (R 4.0.2)                       
 testthat      2.3.2     2020-03-02 [1] CRAN (R 4.0.2)                       
 tibble        3.0.3     2020-07-10 [1] CRAN (R 4.0.2)                       
 tidyr         1.1.2     2020-08-27 [1] CRAN (R 4.0.2)                       
 tidyselect    1.1.0     2020-05-11 [1] CRAN (R 4.0.2)                       
 usethis       1.6.3     2020-09-17 [1] CRAN (R 4.0.2)                       
 vctrs         0.3.4     2020-08-29 [1] CRAN (R 4.0.2)                       
 withr         2.3.0     2020-09-22 [1] CRAN (R 4.0.2)                       
 xfun          0.17      2020-09-09 [1] CRAN (R 4.0.2)                       
 xtable        1.8-4     2019-04-21 [1] CRAN (R 4.0.2)                       
 zip           2.1.1     2020-08-27 [1] CRAN (R 4.0.2)                       
 zoo           1.8-8     2020-05-02 [1] CRAN (R 4.0.2)                       

[1] C:/tmp/r4/library
> 

Plot breaks if there is 'Inf' in the CI

The plot completely breaks if there is an Inf in the CI somewhere. While generating a plot is hard here, the tables should still be generated.

Example:

  library("forestmodel")
  library("survival")
  library("dplyr")
  pretty_lung <- lung %>%
    transmute(time,
              status,
              Age = age,
              Sex = factor(sex, labels = c("Male", "Female")),
              ECOG = factor(lung$ph.ecog),
              `Meal Cal` = meal.cal) %>%
     mutate(time = ifelse(ECOG == 3, 30000, time))
  
  print(forest_model(coxph(Surv(time, status) ~ ., pretty_lung)))

Additional variables for number of events and person years for coxph

(Originally posted as a supplementary question in issue #1 by @arazraw)

Suppose you examine the association between treatment groups and mortality. Using Your package it is easy to present a plot of the association, particularly with "covariates=c()" argument which filters out unwanted predictors. The plot displays number of individuals in each treatment group, along with hazard ratios and p values. But it does not present number of events in both groups, nor event rates (the former would be the most important from an epidemiological perspective). However, it is not a difficult task to code this separately and display it in a separate table but I'm thinking it could be valuable to see directly in the forest plot.

Font family supplied via theme(text = ...) is not honored in plot headings

When supplying a custom font via theme(text = element_text(family = ...)), this is picked up in some places, i.e.

family <- if (is.na(theme$text$family) || theme$text$family == "") "sans" else theme$text$family

but in other places, this is ignored, i.e.

geom_text(aes(x, y, label = label, hjust = hjust, fontface = fontface),
filter(forest_text, parse == parse_type),
na.rm = TRUE, parse = parse_type,
size = format_options$text_size
)

My issue goes away, when I patch through family = theme$text$family to the aes() call in line 414.

Changing Default Font Family

I would like to change the font family for the entire forest plot to Times New Roman, is there a way to make this adjustment?

Forestmodel no longer showing interaction terms in multivariable model

Hello, I have generated some figures in the past that showed the interaction terms in the figure and now they have been removed with only main terms being showing in the plot. How do I switch it back to generate these plots.

library(forestmodel)
library(survival)
library(dplyr)
pretty_lung <- lung %>%
    dplyr::transmute(time,
              status,
              Age = age,
              Sex = factor(sex, labels = c("Male", "Female")),
              ECOG = factor(lung$ph.ecog),
              `Meal Cal` = meal.cal)

print(forest_model(coxph(Surv(time, status) ~ ECOG * Age, pretty_lung)))

coxph(Surv(time, status) ~ ECOG * Age, pretty_lung
+ )
Call:
coxph(formula = Surv(time, status) ~ ECOG * Age, data = pretty_lung)

               coef exp(coef)  se(coef)      z       p
ECOG1       3.94301  51.57385   1.62842  2.421 0.01546
ECOG2       5.29316 198.97030   1.89672  2.791 0.00526
ECOG3       1.76105   5.81852   1.03344  1.704 0.08837
Age         0.05991   1.06174   0.02222  2.696 0.00702
ECOG1:Age  -0.05718   0.94442   0.02540 -2.251 0.02439
ECOG2:Age  -0.06954   0.93283   0.02907 -2.392 0.01677
ECOG3:Age        NA        NA   0.00000     NA      NA

Likelihood ratio test=26.49  on 6 df, p=0.0001804
n= 227, number of events= 164 
   (1 observation deleted due to missingness)

But the output figure only shows

ECOG1 3.94301 51.57385 1.62842 2.421 0.01546
ECOG2 5.29316 198.97030 1.89672 2.791 0.00526
ECOG3 1.76105 5.81852 1.03344 1.704 0.08837
Age 0.05991 1.06174 0.02222 2.696 0.00702

Rplot

Error in plot when infinite value warning in model

The package version is 0.6.2.
When I was plotting

> model = coxph(Surv(os, status) ~ group, total)
Warning message:
In coxph.fit(X, Y, istrat, offset, init, control, weights = weights,  :
  Loglik converged before variable  1,2 ; coefficient may be infinite. 
> print(forest_model(model))
Error in grDevices::axisTicks(log10(exp(forest_min_max)), TRUE) : 
  log - axis(), 'at' creation, _LARGE_ range: invalid {xy}axp or par; nint=5
	 axp[0:1]=(1e-307,1e+308), usr[0:1]=(0,inf); i=615, ni=123

It will run into error in plot when coefficient may be infinite warning is showed.
The result of model seems normal, only some value is too big.

> model
Call:
coxph(formula = Surv(os, status) ~ group, data = total)

              coef exp(coef)  se(coef)     z     p
groupIHR 1.943e+01 2.746e+08 2.993e+03 0.006 0.995
groupEHM 2.032e+01 6.712e+08 2.993e+03 0.007 0.995

Likelihood ratio test=96.25  on 2 df, p=< 2.2e-16
n= 224, number of events= 89 

I think it is acceptable to see inf value when the value is too big.

Overall P-Value for Variables with More than Two Levels

Authors,

First off, thank you for this amazing package. I wanted to ask if it would be possible for variables with more than two levels to show the overall wald p-value. Before building multivariate models, we normally show in the report a list of univariate associations. Your package works great in cases where the variable is continuous, or only has two levels. However, if we take something like race, let's imagine White, Black, Other- this package shows the association for each individual level, but does not show the overall p-value for this association. Possibly this P-value could be listed next to "reference"?

Apologies if this is a distraction and not worth your time. I found your package extremely helpful.

Bug in forest_rma

When I want to use forest_rma, find something wrong with the example code.

GitHub version

image

CRAN version

image

The GitHub version does not eval the last expression and the CRAN version generates wrong forest plot.

Best,
Shixiang

Select test for show_global_p = "aside"?

Hey everyone,

It would be really great, if we could manually select, which test would be shown when selecting show_global_p = "aside".

(In case you ask yourself, where the rest of the bug report ist. I just had it wrong yesterday. Sorry for that.)

Labels

Thank you for your great package.
I have two questions.

1)Can the labels for factors in the panel be changed?
2)Is it available the model that has interaction such as

CoxModelFull<- coxph(Surv(FU, Censor==1)~(Factor1+Facgtor2)^2, data, method="breslow")

A warning message from changing the text_size

Hi NikNakk,
Thank you for your wonderful package!

A Warning message showed up when I trying to modify the text_size in format_options:

'Warning: Ignoring unknown aesthetics: x'

I'm not sure am I doing something wrong? I'm hoping you can help me with this, thanks!
Here, I attached my code:

forest_model(model1,factor_separate_line = T,
             format_options = list(colour= "black", shape = 15, text_size = 20,fontsize=5, banded = T),
             theme = theme_forest())

BTW, I'm also wondering is there a way to modify the size of the point estimates?

Hide panels

Absolutely lovely package - saves huge amounts of time.

As you surely know it is common to perform regression with sequential adjusting (e.g models 1 to 3), and therefore it would be great if one could display several forest plots side by side, and that is doable in current format by (for example) using gridExtra to place the plots next to each other. However, it is desirable to be able to remove some panels from selected plots in order to not repeat variable names. Is it possible to remove that panel, i.e the variable name panel and thus only display "N", "Hazard Ratio", and "P"?

Best regards

Plotting categorical variables without reference

Hi @NikNakk, I like so much your package, it's very easy to use.

I'm doing a survival analysis with categorical variables (I've categorized a numeric value of a gene to different expression levels) and, when I draw the forest_model plot, the first group is used as reference... could you explain why (I though that was a simple ratio) and is there any way to avoid this and take it as another normal variable?

image

Thanks a lot in advance!

Doesn't work with weighted regression

For a (hopefully) reproducible example:

wine is the popular wine quality dataset (red wines).
Now let's try

lm(quality ~ ., data = wine, weights = runif(nrow(wine))) -> model1
lm(quality ~ ., data = wine) -> model2
forestmodel::forest_model(model1) # fails
forestmodel::forest_model(model2) # works fine

Use colors in forestmodel::forest_model

Dear Nick, thank you for the nice forestmodel-package. I appreciate your work very much! Based on your example, I created a nice table of the hazard ratios for all predictors of my cox proportional hazard model. I would love to color the names of the predictors manually. You use fontface = "bold". Is it somehow possible to use fontcol = c("red", "red", "blue", "blue").
Many kind regards from Germany, Anja

Covariates argument doesn't behave as described

Specifying covariates to include in the plot changes the order that covariates are displayed, and how they are displayed, but does not filter to just those variables.

Example:

library("survival")
library("dplyr")
pretty_lung <- lung %>%
  transmute(time,
            status,
            Age = age,
            Sex = factor(sex, labels = c("Male", "Female")),
            ECOG = factor(lung$ph.ecog),
            `Meal Cal` = meal.cal)
print(forest_model(coxph(Surv(time, status) ~ ., pretty_lung), covariates = c("ECOG")))

Using variable labels instead of variable names when available

Variable labels, stored as a label attributes and easily accessible with labelled::var_label(), are becoming quite common. Many packages (like gtsummary) producing graphs or tables are now adopting the following rule: if defined, use variable labels instead of variable names.

Such addition to forestmodel would allow to easily customize the names of variables displayed on forest plots.

Plotting without intercept

I'm finding its package for the representation of the coefficients very useful. I use it often because I consider it the most advanced.

But I did not find a way to remove the intercept from the forest model plot. Do you have any suggestions?
I use this code: print(forest_model(mod)) with library(forestmodel).

Excluding Plot of estimate, only including confidence interval

Hello,

First off, great package, I've made some beautiful visualizations with it, thank you!

Let's say I am plotting the hazard ratios and confidence intervals for 4 variables (A, B, C, D) from a coxph model. A, B, and C are within the range of (0.5, 2), and D is in the range of (0.5, 200,000).

I used the limits argument to limit the x axis, but because the HR for D is much greater than the xmax, it messes up the plot and it is shown in the far right of the panel containing HR, CI, and p-value. The CI shows up fine with an arrow extending towards +infinity. I am wondering if I can exclude the plotting of the HR for variable D, and only include the presentation of the CI. I'd like to do this because when I do not limit the x axis, the visualization is not very interpretable for variables A, B, and C.

Thanks in advance,

Lucas

Tibble deprecation warning: data_frame() -> tibble()

Running your demo code, I get (in addition to a good looking plot) a tibble deprecation warning:

library("forestmodel")
library("survival")
library("dplyr")
pretty_lung <- lung %>%
  transmute(time,
            status,
            Age = age,
            Sex = factor(sex, labels = c("Male", "Female")),
            ECOG = factor(lung$ph.ecog),
            `Meal Cal` = meal.cal)

print(forest_model(coxph(Surv(time, status) ~ ., pretty_lung)))

#> Warning messages:
#> 1: `data_frame()` is deprecated as of tibble 1.1.0.
#> Please use `tibble()` instead.
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_warnings()` to see where this warning was generated.
#> 2: In recalculate_width_panels(panel_positions, mapped_text = mapped_text,  :
#>   Unable to resize forest panel to be smaller than its heading; consider a smaller text size
#> 3: Ignoring unknown aesthetics: x

Forest plot of multiple regression models

It would be nice to estimates from multiple models in one plot. The package sjPlot does that but not for cox models.
Here is an example .

btw the variables labels are still not working, and this feature is really important.

How to plot subgroup data?

Hi @NikNakk and thank you for your great package!

I want to plot a subgroup analysis to show treatment effects in different subgroups, for example as shown here

My question is quite similar to this one here:
#11

For example the subgroup age >65 years and the subgroup <65 years, they both need a hazard ratio to be displayed without a reference.

Do you get these hazard ratios in this example by obtaining two univariate Cox regression analysis for patients >65 years and for patients <65 years?

If I am right with my guess, is there a way to perform the analysis easily with "coxph" and "forest_model", I mean, to transfer all the specific hazard ratios for each subgroup and also to calculate the p for interaction?

Thank you for you help and stay healthy!

Formatting p-value

Thank you so much for this very nice package. I have a question regarding formatting the p-value for display. I would like to format p-values according to the guidelines of the Annals of Medicine. In particular, I would like to use fanetc::format_pvalue() function instead of format.pval(). Is there anyway I can do it?

Slightly off CI limits on glm logistic regression

This is an incredible package, thank you very much for it.

I've just noticed a little difference between the CI I got in the plot, and the CI I got by doing it by hand.
I have written an example with mtcars:

# First the model
m1 <- glm(am ~ mpg, family = binomial, data = mtcars)

# OR and CI (0.95)

round(exp(cbind("Odds ratio" = coef(m1), confint.default(m1, level = 0.95))),2)

# Which results in:

            Odds ratio 2.5 % 97.5 %
(Intercept)       0.00  0.00   0.14
mpg               1.36  1.09   1.70

# With forest_model

> forest_model(m1, return_data = TRUE)$plot_data$forest_data
Warning: Ignoring unknown aesthetics: x
# A tibble: 2 x 14
  term_label variable    class   level level_no     n term        estimate std.error statistic p.value conf.low conf.high reference
  <chr>      <chr>       <chr>   <lgl> <lgl>    <int> <chr>          <dbl>     <dbl>     <dbl>   <dbl>    <dbl>     <dbl> <lgl>    
1 mpg        mpg         numeric NA    NA          32 mpg            0.307     0.115      2.67 0.00751    0.122     0.587 FALSE    
2 NA         (Intercept) NA      NA    NA          NA (Intercept)   -6.60      2.35      -2.81 0.00498  -12.3      -2.77  FALSE 

# In the tibble, before doing the exp, is already different, and in the plot it is "1.36 (1.13, 1.80)"

imagen

It is not a big deal here, but in my real data the p value is less than 0.05 and the CI goes from less than 1 to more than one in the forest plot!
It am not being able to find out where you calculate the confident intervals so I can't figure out what could be doing this... Any idea?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.