R/glm-utils.R
summaryGLM.Rd
Reporting OR from glm with binomial link and glm predictions
summaryGLM(object, id = NULL, fun = NULL, ...)
data(sTRACE)
sTRACE$id <- sample(1:100,nrow(sTRACE),replace=TRUE)
model <- glm(I(status==9)~sex+factor(diabetes)+age,data=sTRACE,family=binomial)
summaryGLM(model)
#> $coef
#> Estimate Std.Err 2.5% 97.5% P-value
#> (Intercept) -6.65169 0.82284 -8.26442 -5.0389 6.278e-16
#> sex 0.25832 0.22418 -0.18107 0.6977 2.492e-01
#> factor(diabetes)1 0.63305 0.30486 0.03553 1.2306 3.785e-02
#> age 0.09591 0.01099 0.07436 0.1175 2.707e-18
#>
#> $or
#> Estimate 2.5% 97.5%
#> (Intercept) 0.001291843 0.0002575172 0.00648057
#> sex 1.294751030 0.8343769033 2.00914026
#> factor(diabetes)1 1.883341432 1.0361638586 3.42317957
#> age 1.100659282 1.0771942608 1.12463545
#>
#> $fout
#> NULL
#>
summaryGLM(model,id=sTRACE$id)
#> $coef
#> Estimate Std.Err 2.5% 97.5% P-value
#> (Intercept) -6.65169 0.80550 -8.23044 -5.0729 1.483e-16
#> sex 0.25832 0.22542 -0.18349 0.7001 2.518e-01
#> factor(diabetes)1 0.63305 0.30242 0.04032 1.2258 3.632e-02
#> age 0.09591 0.01079 0.07476 0.1171 6.104e-19
#>
#> $or
#> Estimate 2.5% 97.5%
#> (Intercept) 0.001291843 0.00026642 0.006264013
#> sex 1.294751030 0.83236170 2.014004528
#> factor(diabetes)1 1.883341432 1.04114557 3.406800200
#> age 1.100659282 1.07763051 1.124180179
#>
#> $fout
#> NULL
#>
nd <- data.frame(sex=c(0,1),age=67,diabetes=1)
predictGLM(model,nd)
#> $coef
#> Estimate Std.Err 2.5% 97.5% P-value
#> (Intercept) -6.65169 0.82284 -8.26442 -5.0389 6.278e-16
#> sex 0.25832 0.22418 -0.18107 0.6977 2.492e-01
#> factor(diabetes)1 0.63305 0.30486 0.03553 1.2306 3.785e-02
#> age 0.09591 0.01099 0.07436 0.1175 2.707e-18
#>
#> $pred
#> Estimate 2.5% 97.5%
#> p1 0.6004375 0.4494731 0.7344613
#> p2 0.6605188 0.5194651 0.7778730
#>