insight
insight copied to clipboard
Store statistic as named list attribute
or a named list as attribute, similar to how pretty_names are stored?
Originally posted by @DominiqueMakowski in https://github.com/easystats/parameters/issues/103#issuecomment-529967458
my idea was merely to generate the statistic column name of parameters using find_statistic, that we would have to tweak to eventually return a list in the case of different statistics type per parameters (as in gams), in which case it would be straightforward to display the correct name for each table component...
❔ ❓
😅 the issue I was trying to address is the following
- currently, the statistic column in parameters (named t, z, F etc.) is hard-coded (for glm, it is named z, for lm, t etc) in model_parameters
- This approach is limited in the case where the statistic names differ between parameters (usually between components types, such as for GAMs)
- I thought we could programmatically retrieve the statistic name (and hence the column name) in parameters using insight::find_statistic. We should tweak this function to return a list of names whenever different, for example
c("t", "t", "t", "F", "F")so then we could programmatically name it"t / F", but with this list it would also be easy to add the correct name to the printing of the tables when they are splitted by components...
😬
So, what you would like to have could be something like this, so we have the statistic's name for each value?
library(insight)
data(mtcars)
m <- lm(mpg ~ wt + cyl + vs, data = mtcars)
get_statistic(m)
#> Parameter Statistic type
#> 1 (Intercept) 11.3994647 t
#> 2 wt -4.1204121 t
#> 3 cyl -2.2234114 t
#> 4 vs 0.3221477 t
Can we have some examples or write up those packages / model classes where this applies? @IndrajeetPatil any ideas?
Oh my god, you guys read my mind!
This is something I have also been thinking about and I would be happy to create a list of models where the statistic cataloguing is a bit more tricky.
I will keep updating the list as I keep exploring different models. Will let you know when I feel like I have covered most of the ground:
t / F-statistic:
scam::scammgcv::gammgcv::bam
z / Chi2-statistic:
I think we can go ahead with this and add the edge cases (with more than one type of statistic) as we encounter them.