-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
simulate.gam with ocat returning unexpected values #319
Comments
Thanks for the report. This is one of those unintentional things; I didn't know the This is a bug (I should probably check to see if a particular family is supported and throw an error for those that don't work). And yes, the fix will be to pass in a linear predictor value for each observation we're simulating for. I don't think the fix is that trivial however; I will need to handle all the other non-standard families and some of those will require different handling to that needed for |
Oh, I’d be happy to help! To be honest, I'm still getting familiar with posterior simulations on a theoretical level, so working with your implementations in gratia is a great opportunity for me to learn. Nevertheless, I'll go through your vignette more carefully, review the |
The fix was much simpler than I imagined previously (at least for |
Thank you so much for your hardwork! This is fantastic |
In simulate-methods.R in gratia, for
ocat
models,predict(type = "response")
currently returns the probability of each category. However, thefix.family.rd
function expects a vector of linear predictor values instead. This discrepancy leads to incorrect handling in thesimulation.gam
output forocat
.I've pasted the
mgcv::fix.family.rd
function for theocat
family here for reference:Reproducible Example
In this example,$4 \times 1$ matrix because
sim
is afix.family.rd
interpreted the output ofpredict(type = "response")
, which isPr(y = 1, 2, 3, 4)
, as linear predictor values, leading to unexpected results. I'm fairly sure this is a bug. If you agree, let me know how you'd like to fix it and I can open a PR. Shouldpredict(type = "link")
be used insimulate.gam
instead?Thank you so much for teaching me about
gam
and{mgcv}
.The text was updated successfully, but these errors were encountered: