我試圖通過使用nlme軟件包中的lmList()來生成不同級別的因子。雖然它從幫助頁面的例子工作,我的數據返回以下錯誤:lmList繪圖錯誤:未找到對象'cF'
library(nlme)
##dataframe used (simplified):
**data.1**
IDf x.var.1 y.var.1
1 1 1 1.856491
2 1 2 2.999224
3 1 3 3.943896
4 1 4 4.903249
5 1 5 6.034319
6 2 6 6.986847
7 2 7 8.024806
8 2 8 9.139255
9 2 9 9.986437
10 2 10 10.760508
##creating the lmlist file fm1
fm2 <- lmList(y.var.1 ~ x.var.1 | IDf, data.1, na.action = na.exclude)
##plotting fm2
Call:
Model: y.var.1 ~ x.var.1 | IDf
Data: data.1
Coefficients:
(Intercept) x.var.1
1 0.8695317 1.0259681
2 1.3724091 0.9508952
Degrees of freedom: 10 total; 6 residual
Residual standard error: 0.1042786
##plotting boxplots ##(or any kinds of plots really)
> plot(fm2, IDf ~ resid(.))
##returning error:
Error in plot.lmList(fm2, IDf ~ resid(.)) : object 'cF' not found
現在我已經搜查,搜查,但我不能似乎找出這個對象'cF'應該意思是,任何幫助將不勝感激!
##EDIT:
> dput(data.1)
structure(list(IDf = c(1, 1, 1, 1, 1, 2, 2, 2, 2, 2), x.var.1 = 1:10,
y.var.1 = c(1.85649137285461, 2.99922390104585, 3.94389558063648,
4.90324945760581, 6.03431888678115, 6.98684730318977, 8.0248061251629,
9.13925481513909, 9.98643662828079, 10.7605079666861)), .Names = c("IDf",
"x.var.1", "y.var.1"), row.names = c(NA, -10L), class = "data.frame")
您可以發佈'dput(data.1)的結果',使這個重現? – 2013-02-28 16:25:30