我打算在以下模型中使用 lht 命令测试系数:
fashion.lm<-lm(LOGS~D2+D3+D4+I(D1*LOGA)+I(D2*LOGA)+I(D3*LOGA)+I(D4*LOGA)+I(D1*LOGC)+I(D2*LOGC)+I(D3*LOGC)+I(D4*LOGC))
但是,当我尝试投入I(D1*LOGA)
使用时lht()
,它会产生错误:
library(car)
lht(fashion.lm,c("I(D1*LOGA)"))
> lht(fashion.lm,c("I(D1*LOGA)"))
Error in constants(lhs, cnames_symb) :
The hypothesis "I(D1*LOGA)" is not well formed: contains bad coefficient/variable names.
In addition: Warning message:
In constants(lhs, cnames_symb) : NAs introduced by coercion
我想知道如何正确地在模型中进行测试?D1*LOGA
我知道一个(不是那么聪明的方法)是在运行回归之前创建一个值等于的变量。但是有没有更方便的方法或者做呢?