在R中使用glarma
包运行移动平均线性模型时,收到以下错误:
**Error in model.frame.default(formula = y ~ -1 + X + offset(offset.nb), :
invalid type (list) for variable 'y'**
set.seed(2908)
library("glarma")
d <- structure(list(Count = c(3, 5, 7, 9, 11, 13, 15, 17, 19, 21),
Intercept = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1), explanatory = c(0.1,
0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.99)), .Names = c("Count",
"Intercept", "explanatory"), class = c("tbl_df", "tbl", "data.frame"
), row.names = c(NA, -10L))
y <- d[, 1]
X <- as.matrix(d[, 2:3])
glarmamod <- glarma(y, X, thetaLags = 3, type = "NegBin", method = "NR",
residuals = "Pearson", alphaInit = 0,
maxit = 100, grad = 1e-6)
glarmamod
为什么会收到此错误?