insight
insight copied to clipboard
`model_info(model)$is_linear` should be `FALSE` with `mblogit()`
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)
})
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
Yes, the model object inherits from lm
(perhaps to leverage existing methods?), but it is not in fact linear.
but family is gaussian and link is identity?
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
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.
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.