margins.multinom - Error in jacobian %*% vcov : non-conformable arguments
Hi Thomas,
I get an error message (Error in jacobian %*% vcov : non-conformable arguments) when running margins on a multinom-object. This issue has also been mentioned by someone else here.
Can you help me out? Many thanks!
Kind regards, Gerjon
## load package
library(nnet)
library(margins)
## code goes here
data(mtcars)
mtcars$am <- factor(mtcars$am)
fit_multinom <- multinom(cyl ~ am, mtcars)
summary(margins(fit_multinom, variables = "am"))
# Error in jacobian %*% vcov : non-conformable arguments
## session info
R version 4.0.5 (2021-03-31)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 10.16
Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] margins_0.3.26 descr_1.1.5 nnet_7.3-15 rio_0.5.26
loaded via a namespace (and not attached):
[1] Rcpp_1.0.6 knitr_1.31 magrittr_2.0.1 MASS_7.3-53.1 hms_1.0.0
[6] xtable_1.8-4 rlang_0.4.10 fansi_0.4.2 tools_4.0.5 data.table_1.14.0
[11] xfun_0.22 tinytex_0.29 utf8_1.2.1 htmltools_0.5.1.1 ellipsis_0.3.1
[16] readxl_1.3.1 yaml_2.2.1 digest_0.6.27 tibble_3.1.0 lifecycle_1.0.0
[21] prediction_0.3.14 crayon_1.4.1 zip_2.1.1 vctrs_0.3.7 curl_4.3
[26] evaluate_0.14 haven_2.3.1 rmarkdown_2.6 openxlsx_4.2.3 stringi_1.5.3
[31] cellranger_1.1.0 compiler_4.0.5 pillar_1.5.1 forcats_0.5.1 foreign_0.8-81
[36] pkgconfig_2.0.3
I am also impacted by this issue!
I am seeing it too. Notably, I'm using code and data that I am sure worked fine in Sept 2020, when I used it for my econometrics class.
me too
Experiencing the same error, but when I changed the vce ="bootstrap" it worked. However, the estimates of the p-values are very different from Stata margins