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

model_info(model)$is_linear should be FALSE with mblogit() #628

Open
vincentarelbundock opened this issue Sep 2, 2022 · 6 comments
Open
Labels
Question ⁉️ Further information is requested

Comments

@vincentarelbundock
Copy link
Contributor

I don't really understand the family code in model_info, but here's a test:

test_that("mblogit is not linear", {
  requiet("mclogit")
  mod <- mblogit(factor(gear) ~ mpg + hp, data = mtcars, trace = FALSE)
  expect_false(model_info(mod)$is_linear)
})
@strengejacke
Copy link
Member

library("mclogit")
#> Loading required package: Matrix
mod <- mblogit(factor(gear) ~ mpg + hp, data = mtcars, trace = FALSE)
inherits(mod, "lm")
#> [1] TRUE
family(mod)
#> 
#> Family: gaussian 
#> Link function: identity

Created on 2022-09-02 with reprex v2.0.2

@strengejacke strengejacke added the Question ⁉️ Further information is requested label Sep 2, 2022
@vincentarelbundock
Copy link
Contributor Author

Yes, the model object inherits from lm (perhaps to leverage existing methods?), but it is not in fact linear.

@strengejacke
Copy link
Member

but family is gaussian and link is identity?

@vincentarelbundock
Copy link
Contributor Author

No, all those are erroneous, I think. This is a multinomial logit model:

https://www.rdocumentation.org/packages/mclogit/versions/0.9.4.2/topics/mblogit

strengejacke added a commit that referenced this issue Sep 2, 2022
@strengejacke
Copy link
Member

Categorical or multinomial? :-) I fixed this for mclogit and mblogit, and also link_inverse(). Must add tests, though, to check whether the results are ok.

@pcinereus
Copy link

I wonder whether a similar issue is at play for models with family = gaussian(link = 'log'). For models with this family, I dont seem to be able to obtain modelbased::estimate_link or insight::get_predict(predict = "link") values on the link scale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Question ⁉️ Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants