insight icon indicating copy to clipboard operation
insight copied to clipboard

Store statistic as named list attribute

Open strengejacke opened this issue 6 years ago • 8 comments
trafficstars

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

strengejacke avatar Sep 10 '19 14:09 strengejacke

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...

DominiqueMakowski avatar Sep 10 '19 14:09 DominiqueMakowski

❔ ❓

strengejacke avatar Sep 10 '19 14:09 strengejacke

😅 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...

😬

DominiqueMakowski avatar Sep 10 '19 15:09 DominiqueMakowski

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

strengejacke avatar Nov 08 '19 08:11 strengejacke

Can we have some examples or write up those packages / model classes where this applies? @IndrajeetPatil any ideas?

strengejacke avatar Nov 02 '20 08:11 strengejacke

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.

IndrajeetPatil avatar Nov 02 '20 08:11 IndrajeetPatil

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::scam
  • mgcv::gam
  • mgcv::bam

z / Chi2-statistic:

IndrajeetPatil avatar Nov 30 '20 11:11 IndrajeetPatil

I think we can go ahead with this and add the edge cases (with more than one type of statistic) as we encounter them.

IndrajeetPatil avatar Oct 30 '21 16:10 IndrajeetPatil