为r中的多个级别创建置信区间图

时间:2018-07-28 00:14:43

标签: r regression gee

我有这个数据框:

 mac<-c( 0.125150,  0.045800, -0.955299, -0.232007,  0.120880, -0.041525,  0.290473, -0.648752,  0.113264, -0.403685)
narc<-c(-0.634753,  0.000492, -0.178591, -0.202462, -0.592054, -0.583173, -0.632375, -0.176673, -0.680557, -0.062127)
darc<-c(-0.434753,  0.000592, -0.278591, -0.402462, -0.692054, -0.783173, -0.732375, -0.576673, -0.880557, -0.162127)
ideo<-c(1,2,3,2,3,2,3,1,2,1)
ex<-data.frame(mac,darc,narc,ideo)

我为此运行了通用估计方程(GEE)回归:

library(geepack)
spss<-coef(summary(geeglm(as.integer(ideo) ~ mac+narc+darc,data = ex, id = ideo,
                                 corstr = "independence"))) %>% 
  mutate(lowerWald = Estimate-1.96*Std.err, # Lower Wald CI
         upperWald=Estimate+1.96*Std.err,   # Upper Wald CI
         df=1, 
         ExpBeta = exp(Estimate)) %>%       # Transformed estimate
  mutate(lWald=exp(lowerWald),              # Upper transformed
         uWald=exp(upperWald))              # Lower transformed
spss
#subsets for ever ideo
ex1<-ex[ex$ideo%in% as.factor(1),] #right men
ex2<-ex[ex$ideo%in% as.factor(2),] #center men
ex3<-ex[ex$ideo%in% as.factor(3),] #far men

我现在想为ideo的每个级别创建一个这样的置信区间图。 enter image description here

0 个答案:

没有答案