3

I have to make some transformations on the confidence intervals of multiple large models made with the lme() function from the nlme package. I'm using the intervals() function to get the intervals, however it is not possible to turn it into a dataframe. Is there any way I could turn this into accessable numbers?

library(nlme)
data(mtcars)
model = lme(mpg ~ disp + cyl, random=~1|gear,  data=mtcars)
CI<-intervals(model, which = "fixed")
Approximate 95% confidence intervals

 Fixed effects:
              lower        est.         upper
(Intercept) 29.43497446 34.66099475 39.8870150353
disp        -0.04163023 -0.02058363  0.0004629675
cyl         -3.04786061 -1.58727681 -0.1266930105
attr(,"label")
[1] "Fixed effects:"

data.frame(CI)
Error in as.data.frame.default(x[[i]], optional = TRUE, stringsAsFactors = 
stringsAsFactors) : 
  cannot coerce class ‘"intervals.lme"’ to a data.frame
Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77

1 Answers1

3

You can use CI$fixed to get the values, then storing in a data frame. E.g.

df <- data.frame(CI$fixed)
CIAndrews
  • 1,046
  • 10
  • 19