更新模型:不删除三向交互条件

时间:2018-07-24 19:51:48

标签: nlme

我的问题与这一问题高度相关: R update() interaction term not dropped

但是,我的预测变量中没有多个类别,因此我不理解我的问题与答案之间的关系。也许我只是不明白...

我想一次减少一个模型简化过程中无关紧要的三向交互项。

但是,会发生以下情况:

model1 <- lme(sum.leafmass ~ stand.td.Sept.2017*stand.wtd.Sept.2017*I((stand.td.Sept.2017)^2)*I((stand.wtd.Sept.2017)^2), random = ~1|block/fence, method="ML", data=subset(Total.CiPEHR, species=="EV"), na.action=na.omit)

model2 <- update(model1,.~.-stand.td.Sept.2017:stand.wtd.Sept.2017:I((stand.td.Sept.2017)^2):I((stand.wtd.Sept.2017)^2))
summary(model2)   ##works correctly to eliminate insignificant 4-way interactions

summary(model2)
                                                                         DF   t-value p-value
(Intercept)                                                               4  3.849259  0.0183
stand.td.Sept.2017                                                        4 -1.436666  0.2242
stand.wtd.Sept.2017                                                       4 -2.921806  0.0432
I((stand.td.Sept.2017)^2)                                                 4  4.594303  0.0101
I((stand.wtd.Sept.2017)^2)                                                4 -0.313197  0.7698
stand.td.Sept.2017:stand.wtd.Sept.2017                                    4 -1.301935  0.2629
stand.td.Sept.2017:I((stand.td.Sept.2017)^2)                              4  1.853451  0.1374
stand.wtd.Sept.2017:I((stand.td.Sept.2017)^2)                             4  4.354757  0.0121
stand.td.Sept.2017:I((stand.wtd.Sept.2017)^2)                             4 -0.028199  0.9789
stand.wtd.Sept.2017:I((stand.wtd.Sept.2017)^2)                            4  1.598564  0.1852
I((stand.td.Sept.2017)^2):I((stand.wtd.Sept.2017)^2)                      4 -1.683214  0.1676
stand.td.Sept.2017:stand.wtd.Sept.2017:I((stand.td.Sept.2017)^2)          4  1.972616  0.1198
stand.td.Sept.2017:stand.wtd.Sept.2017:I((stand.wtd.Sept.2017)^2)         4 -1.635314  0.1773
stand.td.Sept.2017:I((stand.td.Sept.2017)^2):I((stand.wtd.Sept.2017)^2)   4  2.190518  0.0936
stand.wtd.Sept.2017:I((stand.td.Sept.2017)^2):I((stand.wtd.Sept.2017)^2)  4 -0.968249  0.3877

##attempt to remove insignificant 3-way interaction
model3 <- update(model2,.~.,-stand.wtd.Sept.2017:I((stand.td.Sept.2017)^2):I((stand.wtd.Sept.2017)^2))
summary(model3)
                                                                         DF   t-value p-value
(Intercept)                                                               4  3.849259  0.0183
stand.td.Sept.2017                                                        4 -1.436666  0.2242
stand.wtd.Sept.2017                                                       4 -2.921806  0.0432
I((stand.td.Sept.2017)^2)                                                 4  4.594303  0.0101
I((stand.wtd.Sept.2017)^2)                                                4 -0.313197  0.7698
stand.td.Sept.2017:stand.wtd.Sept.2017                                    4 -1.301935  0.2629
stand.td.Sept.2017:I((stand.td.Sept.2017)^2)                              4  1.853451  0.1374
stand.wtd.Sept.2017:I((stand.td.Sept.2017)^2)                             4  4.354757  0.0121
stand.td.Sept.2017:I((stand.wtd.Sept.2017)^2)                             4 -0.028199  0.9789
stand.wtd.Sept.2017:I((stand.wtd.Sept.2017)^2)                            4  1.598564  0.1852
I((stand.td.Sept.2017)^2):I((stand.wtd.Sept.2017)^2)                      4 -1.683214  0.1676
stand.td.Sept.2017:stand.wtd.Sept.2017:I((stand.td.Sept.2017)^2)          4  1.972616  0.1198
stand.td.Sept.2017:stand.wtd.Sept.2017:I((stand.wtd.Sept.2017)^2)         4 -1.635314  0.1773
stand.td.Sept.2017:I((stand.td.Sept.2017)^2):I((stand.wtd.Sept.2017)^2)   4  2.190518  0.0936
stand.wtd.Sept.2017:I((stand.td.Sept.2017)^2):I((stand.wtd.Sept.2017)^2)  4 -0.968249  0.3877

##3-way interaction term still there.

互动项为什么不放弃?预测变量是连续的,因此应该彼此独立,对吧?

有人请解释一下我是否对这里的基本知识不了解...

1 个答案:

答案 0 :(得分:0)

解决了我自己的问题。

虚拟语法错误。 (在。〜。部分中有不正确的逗号)

###Incorrect syntax.
model3 <- update(model2,.~.,-stand.wtd.Sept.2017:I((stand.td.Sept.2017)^2):I((stand.wtd.Sept.2017)^2))

###Correct syntax.
model3 <- update(model2,.~.-stand.wtd.Sept.2017:I((stand.td.Sept.2017)^2):I((stand.wtd.Sept.2017)^2))