带有betareg的predict()错误

时间:2017-03-24 11:41:24

标签: r

我使用betareg()函数通过使用19083行的数据集来确定我的因变量的动态。

M_Beta_F1 <- betareg(Y ~ X1+X2|1, data = data1)
summary(M_Beta_F1)

拟合值通过以下方式提取:

in_Y <- fitted(M_Beta_F1)

我想通过使用具有28779行的新数据集(data2)来确定预测值。

out_Y_response <- predict.glm(M_Beta_F1, data2, type=c("response"))

我收到以下消息

Error in seq_len(p) : argument must be coercible to non-negative integer
In addition: Warning messages:
1: In predict.lm(object, newdata, se.fit, scale = 1, type = ifelse(type ==  :
  calling predict.lm(<fake-lm-object>) ...
2: 'newdata' had 28779 rows but variables found have 19083 rows 
3: In model.matrix.default(Terms, m, contrasts.arg = object$contrasts) :
  variable 'mean' is absent, its contrast will be ignored
4: In model.matrix.default(Terms, m, contrasts.arg = object$contrasts) :
  variable 'precision' is absent, its contrast will be ignored
5: In seq_len(p) : first element used of 'length.out' argument

如何解决此问题?

0 个答案:

没有答案