1

我尝试从gmnl参考手册示例中估计潜在类多项式 logit 模型,它会导致错误"Error in t.default(x) : argument is not a matrix"

其他模型(例如“mixl”)工作

R 版本 4.0.2 (2020-06-22) -- “再次起飞”

平台:x86_64-w64-mingw32/x64(64位)

data("Electricity", package = "mlogit")

Electr <- mlogit.data(Electricity, id.var = "id", choice = "choice",
varying = 3:26, shape = "wide", sep = "")

Elec.lc <- gmnl(choice ~ pf + cl + loc + wk + tod + seas| 0 | 0 | 0 | 1,
data = Electr,
subset = 1:3000,
model = 'lc',
panel = TRUE,
Q = 2)

#Estimating LC model 
#Error in t.default(x) : argument is not a matrix
4

1 回答 1

1

我得到了同样的错误信息。

该问题似乎与mlgit-package有关。

回到先前版本的 mlogit (1.0-2) 后,我能够运行代码。您可以使用以下代码安装此版本:

install.packages("https://cran.r-project.org/src/contrib/Archive/mlogit/mlogit_1.0-2.tar.gz", repos=NULL,type="source")

然后尝试重新运行潜在类模型:

data("Electricity", package = "mlogit")
Electr <- mlogit.data(Electricity, id.var = "id", choice = "choice", varying = 3:26, shape = "wide", sep = "")
Elec.lc <- gmnl(choice ~ pf + cl + loc + wk + tod + seas | 0 | 0 | 0 | 1, data = Electr, subset = 1:3000, model = "lc", panel = TRUE, Q = 2)
summary(Elec.lc)

但是,这只是临时解决方法。

于 2020-08-19T15:34:45.107 回答