AndreaNOdell / hake_growth

Spatiotemporal variation in weight-at-age and its impact on fisheries management
2 stars 0 forks source link

Making preditions on fine-scale spatial domain - need covariates? #8

Open AndreaNOdell opened 2 years ago

AndreaNOdell commented 2 years ago

I was able to create a new spatial domain to create predictions over using Michael's code - yay! However, now as I try to make predictions, I am realizing that I need to have covariate information for each datapoint in the spatial domain (which I do not have).... I was under the impression the spatio-temporal component of the model could predict those areas between sampling sites. Any thoughts? Below is a link to the vignette I am using and the last sentence of the first paragraph in spatial predictions section is where it mentions about the covariates.

https://pbs-assess.github.io/sdmTMB/articles/basic-intro.html#spatial-predictions

spatial domain

kristinmarshall-NOAA commented 2 years ago

I think this means you need to be careful to include any spatial covariates that are in your fitted model. Depth and depth-squared are in the example, but I don't think you have any spatially varying covariates in the models you are fitting. I might be mis-remembering though. The time-varying covariates like Catch_year and Cohort would be the same across all the locations (like Year in the example). Does that help?

AndreaNOdell commented 2 years ago

That definitely helps and does seem to be the case. However now I am running into an error message. I'll keep messing around with it, but thought I'd drop it here in case you see something I don't

str(grid_pred_sdm) 'data.frame': 4575 obs. of 3 variables: $ X : num 890 920 980 890 920 ... $ Y : num 3734 3734 3734 3764 3764 ... $ catch_year: Factor w/ 15 levels "1986","1989",..: 1 1 1 1 1 1 1 1 1 1 ...

Seems to be an issue with the vapply function within the predict function. Maybe there is something wrong with my input dataframe, but I am still trying a few different things and messing around with it. Will keep you posted.