vincentarelbundock / marginaleffects

R package to compute and plot predictions, slopes, marginal means, and comparisons (contrasts, risk ratios, odds, etc.) for over 100 classes of statistical and ML models. Conduct linear and non-linear hypothesis tests, or equivalence tests. Calculate uncertainty estimates using the delta method, bootstrapping, or simulation-based inference
https://marginaleffects.com
Other
392 stars 43 forks source link

Feature requests #1076

Open vincentarelbundock opened 2 months ago

vincentarelbundock commented 2 months ago

This issue collects a series of feature requests currently marked as "wontfix". If you want to continue the conversation on any of those features, please comment in the threads linked below:

FloKa89 commented 3 weeks ago

Dear Vincent, First, I have to thank you for your great package. Next, I want to ask you if it is possible to add the calculation of robust or clustered standard errors for GAM models (mgcv::gam) to your marginaleffects package. So far, trying to use such models, R gives the warning that such SEs may not be supported by the model and calculates normal SEs instead. However, I think that the function gKRLS::estfun.gam tries to facilitate such robust SE computation. I would really appreciate if you can look into the function and, in case that it really allows for such calculation, to think about integrating it into your package. All the best, Flo

vincentarelbundock commented 3 weeks ago

Hi @FloKa89 ,

Glad you like the package.

marginaleffects can already integrate robust standard errors for any model, as long as you can supply a square covariance matrix of same dimensions as the number of coefficients. If the package you mention can supply such matrix, you can feed it to the vcov argument in marginaleffefts directly.