Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

margins.multinom - Error in jacobian %*% vcov : non-conformable arguments #170

Open
gerjonhannink opened this issue Apr 28, 2021 · 4 comments

Comments

@gerjonhannink
Copy link

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  
@gbufton
Copy link

gbufton commented May 26, 2021

I am also impacted by this issue!

@jkhanson1970
Copy link

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.

@IdaHjermitslev
Copy link

me too

@Keniajin
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants