easystats / parameters

:bar_chart: Computation and processing of models' parameters
https://easystats.github.io/parameters/
GNU General Public License v3.0
416 stars 37 forks source link

parameters.marginaleffects transforms the predicted? #947

Closed DominiqueMakowski closed 4 months ago

DominiqueMakowski commented 4 months ago

Estimates are completely transformed 🤔

  model <- lm(Sepal.Width ~ Species * Petal.Length, data = iris)
  pred <- marginaleffects::predictions(model,
                               newdata=insight::get_datagrid(model, "Species"),
                               by="Species") 

  as.data.frame(pred)
#>   rowid    Species estimate  std.error statistic      p.value   s.value
#> 1     1     setosa 4.318558 0.59901749  7.209403 5.619777e-13  40.69455
#> 2     2 versicolor 2.582098 0.06580487 39.238704 0.000000e+00       Inf
#> 3     3  virginica 2.553579 0.15352855 16.632603 4.046299e-62 203.94294
#>   conf.low conf.high Petal.Length Sepal.Width
#> 1 3.144506  5.492611        3.758         3.5
#> 2 2.453123  2.711073        3.758         3.5
#> 3 2.252669  2.854490        3.758         3.5
  parameters::parameters(pred)
#> Predicted |   SE |          95% CI | Statistic |      p |    Species | s.value | Petal.Length
#> ---------------------------------------------------------------------------------------------
#> 75.08     | 0.60 | [23.21, 242.89] |      7.21 | < .001 |     setosa |   40.69 |         3.76
#> 13.22     | 0.07 | [11.62,  15.05] |     39.24 | < .001 | versicolor |     Inf |         3.76
#> 12.85     | 0.15 | [ 9.51,  17.37] |     16.63 | < .001 |  virginica |  203.94 |         3.76

Created on 2024-02-11 with reprex v2.0.2

vincentarelbundock commented 4 months ago

Weird. I cannot reproduce with the github main versions of both packages. The results look normal on my computer.

DominiqueMakowski commented 4 months ago

reinstalled parameters and it's fixed, not sure what happened