Closed zeileis closed 1 year ago
Thanks for the report @zeileis
This is an upstream issue in the parameters
package. I probably won't have time to look at this in the short run, but my guess is it's going to be an easy fix. I opened an issue on the parameters
repo: https://github.com/easystats/parameters/issues/905
Once we/they merge a fix upstream, modelsummary
should work as intended automatically.
That's what I suspected but I wasn't sure. I really need to take some time to look at the easystats packages in more detail...
Thanks for posting the issue upstream.
Do both models return z-statistic or t-statistic?
Neither. The summary(model)
only prints estimates and standard errors.
Ok, put differently: are potential test statistics z or t? :-)
Looking at confint()
, it seems to be z.
z is more commonly used in practice, I would say. That's what coeftest()
returns by default.
Thanks! Background of my question was that your examples in https://github.com/easystats/parameters/issues/905 returned different CI for the same models. Now the results are in line with confint()
.
Ah, well spotted, thanks for the quick fix!
Ah, well spotted, thanks for the quick fix!
@zeileis, this issue was a nice introduction to @strengejacke. He is amazing.
Ok, once parameters 0.21.2.5 is on r-universe, you could run easystats::install_latest()
and it should work.
library("modelsummary")
library("nnet")
data("cns", package = "faraway")
m <- multinom(cbind(An, Sp, Other) ~ Water + Work, data = cns)
#> # weights: 12 (6 variable)
#> initial value 762.436928
#> iter 10 value 685.762336
#> final value 685.762238
#> converged
modelsummary(m, shape = response + term ~ model)
response | (1) | |
---|---|---|
Sp | (Intercept) | 0.375 |
Sp | (0.190) | |
Sp | Water | -0.001 |
Sp | (0.002) | |
Sp | WorkNonManual | 0.116 |
Sp | (0.209) | |
Other | (Intercept) | -1.123 |
Other | (0.280) | |
Other | Water | 0.002 |
Other | (0.003) | |
Other | WorkNonManual | -0.270 |
Other | (0.325) | |
Num.Obs. | 16 | |
R2 | 0.002 | |
R2 Adj. | 0.001 | |
AIC | 1383.5 | |
BIC | 1388.2 | |
RMSE | 0.11 |
Created on 2023-09-29 with reprex v2.0.2
Love it!
Hooray, thank you so much. I successfully re-compiled the multinomial chapter of my "Microeconometrics" lecture notes now: https://discdown.org/microeconometrics/multinomial-response-models.html#malformations-of-the-cns
Daniel @strengejacke nice to meet you! I've been watching your work for some time and the easystats packages are on my list to learn better in my sabbatical next semester.
Vincent @vincentarelbundock thanks for making the introduction.
Description: When using
modelsummary(..., shape = response + term ~ model)
onmultinom()
output I get an error thatresponse
is not found. Possibly this is becauseget_estimates()
does not recognize all response labels. When I fit the equivalent model with a factor response, everything works as expected.Reproducible example: Using the
cns
data from the faraway package I want to model the type of CNS malformation (Anencephalus, Spina bifida, Other) by water hardness and type of work of the parents. The data is tabulated in wide format with the columnsAn
,Sp
, andOther
giving the numbers of cases.Running
modelsummary()
with theshape
specification yields an error:This is despite
response
being a column name in:Note, however, that
response
incorrectly listsSp
for all six rows rather thanOther
for the last three rows.If I reshape the data first to long format with a factor response then I can fit an equivalent model for which everything works smoothly:
With previous versions of
modelsummary
I was able to obtain equivalent model summaries for bothm
andm2
. But with the current CRAN or devel version only the latter works.