[R] Extracting only some coefficients for the logistic regression model and its plot
anteneh asmare
h@n@tezer@ @end|ng |rom gm@||@com
Tue Jun 14 22:01:21 CEST 2022
sample_data = read.table("http://freakonometrics.free.fr/db.txt",header=TRUE,sep=";")
head(sample_data)
model = glm(Y~0+X1+X2+X3,family=binomial,data=sample_data)
summary(model)
exp(coef(model ))
exp(cbind(OR = coef(model ), confint(model )))
I have the aove sample data on logistic regression with categorical predictor
I try the above code i get the follwing out put,
OR 2.5 % 97.5 %
X1 1.67639337 1.352583976 2.09856514
X2 1.23377720 1.071959330 1.42496949
X3A 0.01157565 0.001429430 0.08726854
X3B 0.06627849 0.008011818 0.54419759
X3C 0.01118084 0.001339984 0.08721028
X3D 0.01254032 0.001545240 0.09539880
X3E 0.10654454 0.013141540 0.87369972
but i am wondering i want to extract OR and CI only for factors, My
desire out put will be
OR 2.5 % 97.5 %
X3A 0.01157565 0.001429430 0.08726854
X3B 0.06627849 0.008011818 0.54419759
X3C 0.01118084 0.001339984 0.08721028
X3D 0.01254032 0.001545240 0.09539880
X3E 0.10654454 0.013141540 0.87369972
Can any one help me the code to extact it?
additionally I want to plot the above OR with confidence interval for
the extracted one
can you also help me the code with plot,or box plot
Kind Regards,
Hana
More information about the R-help
mailing list