3
R中的效果包可以用於繪製不包含截距的線性模型的邊際效果嗎?R中的效果包可以用於沒有攔截的lm模型嗎?
下面是一些R代碼裏面我嘗試了這樣的模式:
x <- seq(1,100,by=0.1)
y <- 1 + 2*x + rnorm(n=length(x))
model <- lm(y ~ 0 + x)
require(effects)
plot(allEffects(model))
它產生的誤差如下:
Error in plot(allEffects(model)) :
error in evaluating the argument 'x' in selecting a method for function 'plot':
Error in mod.matrix %*% mod$coefficients[!is.na(mod$coefficients)] :
non-conformable arguments
如果任何人有如何克服這種錯誤的任何想法,請告訴我。
感謝,
伊莎貝拉