s******1 发帖数: 39 | 1 请教高手,下面这一段R code 是什么意思?谢谢
getLMOutFunc = function(lmOut){
highSEL = coef(lmOut)[,"Estimate"][["(Intercept)"]] + coef(lmOut)[,"
Estimate"][["pred"]]
lowSEL = coef(lmOut)[,"Estimate"][["(Intercept)"]] - coef(lmOut)[,"
Estimate"][["pred"]]
sampleN = as.numeric(lmOut[["ngrps"]])
if(coef(lmOut)[row.names(coef(lmOut))=="pred",][[4]]<.05) {
sig = coef(lmOut)[row.names(coef(lmOut))=="pred",][[4]]
} else {
sig = "ns"
}
return(list("High SEL" = highSEL, "Low SEL" = lowSEL, "Sig" = sig, "N" =
sampleN))
} | n******g 发帖数: 2201 | 2 a function taking lmout as the argument and return a list
lmout is probably something like:
lmout <- lm(speed ~ dist, data = cars)
you can try:
getLMOutFunc(x) where x is an object of
【在 s******1 的大作中提到】 : 请教高手,下面这一段R code 是什么意思?谢谢 : getLMOutFunc = function(lmOut){ : highSEL = coef(lmOut)[,"Estimate"][["(Intercept)"]] + coef(lmOut)[," : Estimate"][["pred"]] : lowSEL = coef(lmOut)[,"Estimate"][["(Intercept)"]] - coef(lmOut)[," : Estimate"][["pred"]] : sampleN = as.numeric(lmOut[["ngrps"]]) : if(coef(lmOut)[row.names(coef(lmOut))=="pred",][[4]]<.05) { : sig = coef(lmOut)[row.names(coef(lmOut))=="pred",][[4]] : } else {
| s***c 发帖数: 1664 | 3 ngrps是lme4的function, return categorical variable的level数. 整个function似
乎是return linear mixed model 的output里面每个random effect(一般是
categorical variable)的intercept estimate的区间, 是否significant, 和level数.
还是得看看lmout长什么样 | s******1 发帖数: 39 | 4 非常感谢,
下面是 regression model 部分:
用学生情商(pred)来预测学生GPA, IEP(学生残疾Y/N), FRL(学生低收入Y/N), ELL(学
生英语非母语Y/N)
lmOut = lm(GPA ~ IEP + FRL + ELL + pred, data=reg2data) |
|