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.78579 -8.19180 -5.1116 2.561e-17
#> sex 0.25832 0.21987 -0.17262 0.6893 2.400e-01
#> factor(diabetes)1 0.63305 0.30858 0.02824 1.2379 4.022e-02
#> age 0.09591 0.01027 0.07578 0.1160 9.677e-21
#>
#> $or
#> Estimate 2.5% 97.5%
#> (Intercept) 0.001291843 0.0002769156 0.006026595
#> sex 1.294751030 0.8414608803 1.992225985
#> factor(diabetes)1 1.883341432 1.0286403954 3.448216660
#> age 1.100659282 1.0787275040 1.123036959
#>
#> $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
#>