I have the following linear models

library(nlme)
fm2 <- lme(distance ~ age + Sex, data = Orthodont, random = ~ 1)
fm2.lm <- lm(distance ~ age + Sex,data = Orthodont)

How can I obtain the standard error of distance with age and Sex?

有帮助吗?

解决方案

For fm2 (linear mixed model), you can do

sqrt(diag(summary(fm2)$varFix))
#(Intercept)         age   SexFemale 
# 0.83392247  0.06160592  0.76141685 

For fm2.lm (linear model), you can do

summary(fm2.lm)$coefficients[, "Std. Error"]
#(Intercept)         age   SexFemale 
# 1.11220946  0.09775895  0.44488623 

其他提示

see attributes(summary(your.model)). what you're after is summary(your.model)$coefficients (or did I get your question wrong?). just use subsetting with [] to get what you want

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top