I am working in R and would like to obtain the 95% confidence intervals associat
ID: 3065942 • Letter: I
Question
I am working in R and would like to obtain the 95% confidence intervals associated with trt, c_alcuse, and motivationabstain. How would I go about that?
or = glm(abstain1alc~ trt+ age + gender + C_alcuse + motivationabstain, family=binomial(link="logit"))
> OR
Error: object 'OR' not found
> or
Call: glm(formula = abstain1alc ~ trt + age + gender + C_alcuse + motivationabstain,
family = binomial(link = "logit"))
Coefficients:
(Intercept) trt1 age genderM C_alcuse2
-2.19266 0.64674 0.03931 0.12526 0.12069
C_alcuse3 C_alcuse4 C_alcuse5 C_alcuseMissing motivationabstain1
0.25532 0.10074 0.60688 1.27411 0.75098
Degrees of Freedom: 1099 Total (i.e. Null); 1090 Residual
Null Deviance: 1427
Residual Deviance: 1310 AIC: 1330
Explanation / Answer
To obtain the 95% confidence intervals associated with the attributes trt, c_alcuse, and motivationabstain, you need to use the R function confint which belongs to the MASS package in R.
The code that you need to write is :
confint(or , c("trt" , "C_alcuse" , "motivationabstain") , level = 0.95)
The above code gives the 95% confidence interval for the attributes trt, c_alcuse, and motivationabstain in the model that is stored in the object named 'or'.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.