6

I am fitting several logistic regression models, and trying to use the package texreg to create a nicely looked table to present all models.

As I know, texreg::screenreg can only report the coefficients (the betas) and the correspondings CIs, but for logistic regression, but it is more common to report the exponent of the coefficients (the odds ratios).

I know that I can use override.coef, override.ci.low and override.ci.up to get what I want, but the output table is not desirable, it gives an asterisk if a CI cover 0 which should be 1 after transformation.

Is there a better and simpler way to transform the coefficients and the CIs? Also, is it possible for me to override the asterisk, I want to provide asterisk to represent the magnitude of p-value (*** p < 0.001, ** p < 0.01, * p < 0.05) ? Thanks!


Here is what I have tried

> set.seed(123)
> x1 <- rnorm(1000)
> x2 <- rnorm(1000)
> y <- runif(1000) < (1 / (1 + exp(-(0.3 + 0.5*x1))))
> mod1 <- glm(y~x1, binomial())
> mod2 <- glm(y~x2, binomial())
> mod3 <- glm(y~x1+x2, binomial())
> 
> tex1 <- extract(mod1)
> tex2 <- extract(mod2)
> tex3 <- extract(mod3)
> 
> screenreg(list(tex1, tex2, tex3), ci.force=T)

==========================================================
                Model 1       Model 2        Model 3      
----------------------------------------------------------
(Intercept)        0.30 *        0.28 *         0.30 *    
                [0.17; 0.43]  [ 0.15; 0.41]  [ 0.17; 0.43]
x1                 0.60 *                       0.60 *    
                [0.45; 0.74]                 [ 0.45; 0.74]
x2                               0.05           0.01      
                              [-0.07; 0.18]  [-0.12; 0.14]
----------------------------------------------------------
AIC             1294.48       1369.92        1296.47      
BIC             1304.30       1379.74        1311.19      
Log Likelihood  -645.24       -682.96        -645.23      
Deviance        1290.48       1365.92        1290.47      
Num. obs.       1000          1000           1000         
==========================================================
* 0 outside the confidence interval

After overriding,

> tex1@coef <- exp(tex1@coef)
> tex2@coef <- exp(tex2@coef)
> tex3@coef <- exp(tex3@coef)
> 
> ci1 <- confint(mod1)
Waiting for profiling to be done...
> ci2 <- confint(mod2)
Waiting for profiling to be done...
> ci3 <- confint(mod3)
Waiting for profiling to be done...
> 
> tex1@ci.low <- exp(ci1[, 1])
> tex2@ci.low <- exp(ci2[, 1])
> tex3@ci.low <- exp(ci3[, 1])
> tex1@ci.up <- exp(ci1[, 2])
> tex2@ci.up <- exp(ci2[, 2])
> tex3@ci.up <- exp(ci3[, 2])
> 
> screenreg(list(tex1, tex2, tex3))

========================================================
            Model 1       Model 2       Model 3     
--------------------------------------------------------
(Intercept)        1.34 *        1.32 *        1.34 *   
                [1.18; 1.53]  [1.17; 1.50]  [1.18; 1.53]
x1                 1.81 *                      1.81 *   
                [1.58; 2.10]                [1.58; 2.10]
x2                               1.05 *        1.01 *   
                              [0.93; 1.19]  [0.89; 1.15]
--------------------------------------------------------
AIC             1294.48       1369.92       1296.47     
BIC             1304.30       1379.74       1311.19     
Log Likelihood  -645.24       -682.96       -645.23     
Deviance        1290.48       1365.92       1290.47     
Num. obs.       1000          1000          1000        
========================================================
* 0 outside the confidence interval
4

1 回答 1

4

有一个ci.test参数可以设置为“空值”,在这种情况下适用于转换后的参数。它应该设置为 1.0 而不是 0。所以这成功了:

  screenreg(list(tex1, tex2, tex3), ci.test=1)

#------output--------
========================================================
                Model 1       Model 2       Model 3     
--------------------------------------------------------
(Intercept)        1.34 *        1.32 *        1.34 *   
                [1.18; 1.53]  [1.17; 1.50]  [1.18; 1.53]
x1                 1.81 *                      1.81 *   
                [1.58; 2.10]                [1.58; 2.10]
x2                               1.05          1.01     
                              [0.93; 1.19]  [0.89; 1.15]
--------------------------------------------------------
AIC             1294.48       1369.92       1296.47     
BIC             1304.30       1379.74       1311.19     
Log Likelihood  -645.24       -682.96       -645.23     
Deviance        1290.48       1365.92       1290.47     
Num. obs.       1000          1000          1000        
========================================================
* 1 outside the confidence interval

请注意,6 个参数估计值中有 2 个不再加星标。

于 2015-12-23T06:22:17.917 回答