Prediction a grid for a specific year
get_prediction_grid.Rd
Prediction a grid for a specific year
Arguments
- year
Numeric string. The years the data is available for.
- x
Data.frame. The data.frame of the covariate data going into the model.
- subsel
Default = NULL.
- varsbyyr
Character string. The name of the variables that vary by year.
- vars
Character string. The name of the variables that do not vary by year.
Examples
dat <- data.frame(
lon = rnorm(n = 10, mean = 170, sd = 10),
lat = rnorm(n = 10, mean = 170, sd = 10),
sx = rnorm(n = 10, mean = 60, sd = 10),
sy = rnorm(n = 10, mean = 170, sd = 10),
covA = rnorm(n = 10, mean = 3, sd = 10),
covB2019 = rnorm(n = 10, mean = 20, sd = 10),
covB2020 = rnorm(n = 10, mean = 20, sd = 10),
covB2021 = rnorm(n = 10, mean = 20, sd = 10),
covB2022 = rnorm(n = 10, mean = 20, sd = 10),
EFFORT = rnorm(n = 10, mean = 20, sd = 10))
vars <- "covA"
varsbyyr <- "covB"
YEARS <- 2019:2022
pg <- lapply(YEARS,
FUN = get_prediction_grid,
x = dat,
vars = vars,
varsbyyr = varsbyyr)
names(pg) <- YEARS
pg
#> $`2019`
#> lon lat sx sy covA covB EFFORT
#> 1 164.2112 167.2785 47.29487 171.2430 -12.625184 32.037678 1
#> 2 187.6379 145.5332 65.42142 160.0157 3.710534 5.687292 1
#> 3 171.3299 170.6549 60.75106 182.3339 -3.395348 33.829109 1
#> 4 173.7650 159.0149 65.58514 173.4042 -5.451957 20.031259 1
#> 5 181.3871 163.6682 64.15406 165.2730 9.752447 19.221132 1
#> 6 182.4126 149.3635 45.47700 177.0875 14.533758 24.414282 1
#> 7 176.1209 196.4893 69.41206 154.7104 -13.865047 21.289229 1
#> 8 165.7062 158.4660 56.61064 172.3743 -6.028149 11.697857 1
#> 9 183.6046 166.5936 59.24426 156.8719 16.176337 14.964071 1
#> 10 169.2914 177.8636 60.40204 177.4703 14.001897 8.063588 1
#>
#> $`2020`
#> lon lat sx sy covA covB EFFORT
#> 1 164.2112 167.2785 47.29487 171.2430 -12.625184 12.482767 1
#> 2 187.6379 145.5332 65.42142 160.0157 3.710534 34.558414 1
#> 3 171.3299 170.6549 60.75106 182.3339 -3.395348 11.713965 1
#> 4 173.7650 159.0149 65.58514 173.4042 -5.451957 22.897745 1
#> 5 181.3871 163.6682 64.15406 165.2730 9.752447 15.199465 1
#> 6 182.4126 149.3635 45.47700 177.0875 14.533758 13.951706 1
#> 7 176.1209 196.4893 69.41206 154.7104 -13.865047 34.601102 1
#> 8 165.7062 158.4660 56.61064 172.3743 -6.028149 21.496794 1
#> 9 183.6046 166.5936 59.24426 156.8719 16.176337 5.666789 1
#> 10 169.2914 177.8636 60.40204 177.4703 14.001897 19.896967 1
#>
#> $`2021`
#> lon lat sx sy covA covB EFFORT
#> 1 164.2112 167.2785 47.29487 171.2430 -12.625184 17.877640 1
#> 2 187.6379 145.5332 65.42142 160.0157 3.710534 10.936598 1
#> 3 171.3299 170.6549 60.75106 182.3339 -3.395348 -1.021525 1
#> 4 173.7650 159.0149 65.58514 173.4042 -5.451957 38.933605 1
#> 5 181.3871 163.6682 64.15406 165.2730 9.752447 10.318742 1
#> 6 182.4126 149.3635 45.47700 177.0875 14.533758 18.973970 1
#> 7 176.1209 196.4893 69.41206 154.7104 -13.865047 22.399596 1
#> 8 165.7062 158.4660 56.61064 172.3743 -6.028149 20.608989 1
#> 9 183.6046 166.5936 59.24426 156.8719 16.176337 -1.775760 1
#> 10 169.2914 177.8636 60.40204 177.4703 14.001897 18.821399 1
#>
#> $`2022`
#> lon lat sx sy covA covB EFFORT
#> 1 164.2112 167.2785 47.29487 171.2430 -12.625184 21.12295 1
#> 2 187.6379 145.5332 65.42142 160.0157 3.710534 20.07886 1
#> 3 171.3299 170.6549 60.75106 182.3339 -3.395348 38.77744 1
#> 4 173.7650 159.0149 65.58514 173.4042 -5.451957 41.58757 1
#> 5 181.3871 163.6682 64.15406 165.2730 9.752447 27.09715 1
#> 6 182.4126 149.3635 45.47700 177.0875 14.533758 27.66983 1
#> 7 176.1209 196.4893 69.41206 154.7104 -13.865047 16.91789 1
#> 8 165.7062 158.4660 56.61064 172.3743 -6.028149 30.12002 1
#> 9 183.6046 166.5936 59.24426 156.8719 16.176337 10.80948 1
#> 10 169.2914 177.8636 60.40204 177.4703 14.001897 25.63380 1
#>