Manual conditional effects plot with newdata
and nsim
#161
Answered
by
seananderson
maxlindmark
asked this question in
Q&A
Replies: 2 comments 1 reply
-
Just to clarify, I'm interested in the total delta model prediction eventually (if I only wanted the conditional effect from the Binomial model I could have done it the normal way, but my issue for the total model prediction can be exemplified with only one of the components so that's why I'm doing that) |
Beta Was this translation helpful? Give feedback.
0 replies
-
There are two issues here.
Predicting with missing years is done by adding fake years and removing
them in the end, but I forgot to remove them for the nsim output option.
There’s no reason why we can’t return standard errors on the combined
prediction. We can add that.
One caveat is that the response curve shape depends on the value of the
other predictors when you have two different links.
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
maxlindmark
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm playing around with delta-beta models by fitting two components separately, following the vignette.
Here's an example of the Binomial part:
I want to visualise conditional effects of depth in this case. I gather I should use the
nsim
argument to get uncertainty on the predictions. Since I only want the conditional effect of depth (and also because I have spatial effects turned off in this case), I provide a newdata with a specific year and varying depth.When I predict I get the following warning:
This seems ok, only a warning right? But then I look at the output, it looks like this:
I.e., the years in the fitting data not provided in
newdata
have been appended to the prediction output. I don't really understand where these come from, because I read this from?predict.sdmTMB
: Returns a matrix of nrow(data) by nsim representing the estimates of the linear predictor (i.e., in link space).For plotting the sims against a covariate I could filter rows in this matrix that corresponds to
nd
, so that I can join in the depth values fromnd
into the sims output. But at this point I'm a bit hesitant this is the right way to do this, and I wonder if sims is mainly intended for index standardisation and/or gridded predictions (not non-spatial models). Or if I'm misunderstanding something about hownewdata
andnsim
interact.How would you approach plotting conditional effects with uncertainty with a delta model that isn't built in?
Thanks for tips and help!
Beta Was this translation helpful? Give feedback.
All reactions