class: center, middle, inverse, title-slide .title[ # Building a prediction grid ] .subtitle[ ## IMR sdmTMB workshop ] .author[ ### ] .date[ ### May 23–25 2023 ] --- <!-- Build with: xaringan::inf_mr() --> # Why do we need a prediction grid? * Generate some index of abundance * Making pretty maps! --- # Approach 1: at locations of data ```r pred <- predict(fit) ``` * Why? evaluating residuals --- # Approach 2: mesh locations * Predict to locations of mesh vertices * These are where random effects are estimated * spatial fields * spatiotemporal fields * spatially varying coefficients * Why? Diagnostics / understanding mesh & uncertainties See [https://github.com/pbs-assess/sdmTMB/discussions/230](https://github.com/pbs-assess/sdmTMB/discussions/230) --- # Approach 3: regular grid * see `qcs_grid` as example (4km grid) * generally built from survey design, excludes land * Why? Standardized index of abundance across survey domain See `?get_index` <img src="08-prediction-grid_files/figure-html/unnamed-chunk-2-1.png" width="700px" style="display: block; margin: auto;" /> --- # Approach 4: grid based on the locations of observations * Things to consider: spatial grid cell size? * How many time steps should have observations? * Why? Domain grid not available, applicable * e.g. rock / reef associated fishes Code: [https://github.com/pbs-assess/sdmTMB-teaching/blob/main/imr-2023/exercises/coastal-survey-ex/coastal-survey-index-south.R#L205](https://github.com/pbs-assess/sdmTMB-teaching/blob/main/imr-2023/exercises/coastal-survey-ex/coastal-survey-index-south.R#L205) --- # Tips and tricks * Any prediction grid or dataframe will need to have values for all covariates * Excamples: year, depth, temperature * Random effects = exception, can be NA