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

Request for mlogit support #192

Closed
jamgreen opened this issue Jan 27, 2017 · 3 comments · Fixed by #887
Closed

Request for mlogit support #192

jamgreen opened this issue Jan 27, 2017 · 3 comments · Fixed by #887

Comments

@jamgreen
Copy link

The mlogit package for multnomial logit estimation would be a valuable addition to broom capabilities.

@RMHogervorst
Copy link

you could use nnet::multinomial as an alternative?
They already work in broom

@IndrajeetPatil
Copy link
Contributor

Just posting an example to show that it doesn't work with mlogit objects.

# setup and data
set.seed(123)
library(mlogit)
#> Loading required package: Formula
#> Loading required package: zoo
#> 
#> Attaching package: 'zoo'
#> The following objects are masked from 'package:base':
#> 
#>     as.Date, as.Date.numeric
#> Loading required package: lmtest
data("Fishing", package = "mlogit")
Fish <- mlogit.data(Fishing, varying = c(2:9), shape = "wide", choice = "mode")

# a pure "conditional" model
mod <- mlogit(mode ~ price + catch, data = Fish)

# summary
summary(mod)
#> 
#> Call:
#> mlogit(formula = mode ~ price + catch, data = Fish, method = "nr")
#> 
#> Frequencies of alternatives:
#>   beach    boat charter    pier 
#> 0.11337 0.35364 0.38240 0.15059 
#> 
#> nr method
#> 7 iterations, 0h:0m:0s 
#> g'(-H)^-1g = 6.22E-06 
#> successive function values within tolerance limits 
#> 
#> Coefficients :
#>                       Estimate Std. Error  z-value  Pr(>|z|)    
#> boat:(intercept)     0.8713749  0.1140428   7.6408 2.154e-14 ***
#> charter:(intercept)  1.4988884  0.1329328  11.2755 < 2.2e-16 ***
#> pier:(intercept)     0.3070552  0.1145738   2.6800 0.0073627 ** 
#> price               -0.0247896  0.0017044 -14.5444 < 2.2e-16 ***
#> catch                0.3771689  0.1099707   3.4297 0.0006042 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Log-Likelihood: -1230.8
#> McFadden R^2:  0.17823 
#> Likelihood ratio test : chisq = 533.88 (p.value = < 2.22e-16)

# confidence intervals for coefficients
confint(mod)
#>                           2.5 %      97.5 %
#> boat:(intercept)     0.64785507  1.09489475
#> charter:(intercept)  1.23834489  1.75943188
#> pier:(intercept)     0.08249473  0.53161576
#> price               -0.02813012 -0.02144898
#> catch                0.16163032  0.59270739

# tidier exists?
broom::tidy(mod)
#> Error: No tidy method for objects of class mlogit

Created on 2019-03-18 by the reprex package (v0.2.1.9000)

@github-actions
Copy link

github-actions bot commented Mar 7, 2021

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants