0

我有 1,000 个因变量 (y) 可在 Ancova 中使用。自变量 (x) 在所有模型中都相同。

Yvar1, Yvar2, …, Yvar1000, x1, x2
1       2          5       11  16
2       3          6       18  23

我需要一个 R 代码来替换example$Y.to.use每个 Yvar 的值。

我试过这个:

for (i in 1:1000){ 
example$Y.to.use<- example$paste("Yvar",i, sep="")

# Error: attempt to apply non-function

paste("fitted.model",i)<-lme(log(Y.to.use+1)  ~ x1*x2, data=example, random=~1| Exp/Person)
} 

# Error in paste("fitted.model", i, sep = "") <- lme(log(Y.to.use+1)  ~ x1*x2  : target of assignment expands to non-language object

我将创建一个表格,其中包含每个 Yvar 的每个拟合模型的系数。

4

0 回答 0