是否有可能将R效应或效果与rsm结合起来?

时间:2015-07-22 18:41:19

标签: r

我尝试了一个带线性术语的rsm:

> rsm_test.2 <- rsm(Nu_2H_Mittel ~ FO(x1, x2, x3, x4, x5, x5, x6) , data=Nu_112_gr_7.5.coded )

>  plot(allEffects(rsm_test.2), ask=False)

但收到错误消息:(德语翻译!)

  

情节错误(allEffects(rsm_test.2),ask = False):   评估参数的错误&#39; x&#39;用方法选择   for function&#39; plot&#39;:lapply中的错误(X = X,FUN = FUN,...):对象&#39; x1&#39;找不到

示例:

un<-c(9.315076, 21.831509, 12.159635, 14.106338, 29.992457, 25.009093, 28.183301, 16.406841)
g<-c(  0.2681000,  1.1049000,  1.2030000,  1.0515000,  0.4709000,0.5366000,  0.4205000,  1.3201000)
D<-c(  12.282000,  19.311000,  16.785000,  13.271000,   9.191000,  18.261000,   8.454000,  16.338000)
er<-c(  1285,  1793,  1763,  1232,  1848,  1832,  1618,  1490)
un_all<-data.frame(un,D,g,er)
un_all.coded  <- coded.data(un_all , x1~(D-12.5)/7.5, x2~(g-5.125)/4.875, x3~(er-1750)/550)
#works:
rsm_un_all_coded.1 <- rsm(un ~ FO(x1, x1*x1, x2, x2*x2, (x3+1.75)^0.2 )+ TWI(x1, x2, x3) , data=un_all.coded )
#errored
plot(allEffects(rsm_un_all_coded.1))
#doesn't work
rsm_un_all_coded.2 <- lm(un ~ x1+x1*x1+ x2+x2*x2+ (x3+1.75)^0.2 + x1*x2+ x1*x3+ x2*x3 , data=un_all.coded

1 个答案:

答案 0 :(得分:0)

解决方案: 对于这种情况,可以通过 lm()而不是 rsm()生成模型。但是,higehr订单条款必须写成 I(...)。然后效果起作用:

lm.test <- lm(un ~ I(x1+x1^2)+ I(x2+x2^2)+ I(x3+x3^2) + x1*x2) 
plot(allEffects( lm.test ))

混合术语*(如x1 * x2)*必须在没有&#34; I&#34; ...的情况下添加...但是:效果将它们视为自己的因素,而不是分别与x1或x2一起使用..