mlogit example produces an error
sam-crawley opened this issue · comments
Sam Crawley commented
The example for mlogit from the documentation does not work for me:
library("prediction")
library(mlogit)
data("Fishing", package = "mlogit")
Fish <- mlogit.data(Fishing, varying = c(2:9), shape = "wide", choice = "mode")
mod <- mlogit(mode ~ price + catch, data = Fish)
prediction(mod)
Produces: Error in tmp[["fit"]] : subscript out of bounds
traceback:
4: data.frame(..., check.rows = FALSE, check.names = FALSE, fix.empty.names = FALSE,
stringsAsFactors = FALSE)
3: make_data_frame(data, fitted = tmp[["fit"]], se.fitted = tmp[["se.fit"]])
2: prediction.default(mod)
1: prediction(mod)
sessionInfo:
R version 3.6.0 (2019-04-26)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.2 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/atlas/libblas.so.3.10.3
LAPACK: /usr/lib/x86_64-linux-gnu/atlas/liblapack.so.3.10.3
locale:
[1] LC_CTYPE=en_NZ.UTF-8 LC_NUMERIC=C LC_TIME=en_NZ.UTF-8 LC_COLLATE=en_NZ.UTF-8 LC_MONETARY=en_NZ.UTF-8
[6] LC_MESSAGES=en_NZ.UTF-8 LC_PAPER=en_NZ.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_NZ.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] mlogit_0.4-2 lmtest_0.9-37 zoo_1.8-6 Formula_1.2-3 prediction_0.3.14
loaded via a namespace (and not attached):
[1] lattice_0.20-38 MASS_7.3-51.4 grid_3.6.0 magrittr_1.5 bibtex_0.4.2 Rdpack_0.11-0 stringi_1.4.3 data.table_1.12.2
[9] statmod_1.4.32 tools_3.6.0 stringr_1.4.0 yaml_2.2.0 compiler_3.6.0 gbRd_0.4-11
Thomas J. Leeper commented
Thanks - I'll investigate.
Thomas J. Leeper commented
Hmm. Unfortunately, I'm not able to reproduce this error.