Skip to content

Commit

Permalink
add new vignette edits to vignettes/ version of Basics of 5 Yr Review…
Browse files Browse the repository at this point in the history
… vignette
  • Loading branch information
MargaretSiple-NOAA committed Nov 15, 2024
1 parent 332126c commit adde552
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions vignettes/BasicsOfFiveYearReview.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,20 @@ library(akgfmaps)
# Load the data and add more info

```{r eval=F}
data("region_data_all")
data("GOA_bathy")
data("GOA_btemp")
data("GOA_lat")
data("GOA_lon")
data("GOA_slope")
data("GOA_sponge")
data("raster_stack")
region.data <- region_data_all
bathy <- GOA_bathy
btemp <- GOA_btemp
btemp <- raster::crop(x = btemp, y = bathy)
#btemp <- raster::crop(x = btemp, y = bathy)
slope <- GOA_slope
sponge <- GOA_sponge
Expand All @@ -49,7 +58,7 @@ region.data$logarea <- log(region.data$area)
lat <- GOA_lat
lon <- GOA_lon
raster.stack <- terra::rast(raster_stack, crs=3338)
raster.stack <- terra::rast(raster_stack)
names(raster.stack) <- c("lon", "lat", "bdepth", "btemp", "slope", "sponge")
# Using terra, the raster values are not automatically passed as factors when plugged into
Expand Down Expand Up @@ -126,7 +135,7 @@ maxnet.abund <- MakeMaxEntAbundance(
scale.fac = maxnet.scale, type = "cloglog"
)
# Now crossvalidate and get fit metrics
# Now cross-validate and get fit metrics
maxnet.cv <- CrossValidateModel(
model = maxnet.model, data = species.data, species = species, group = "Folds",
model.type = "maxnet", key = "hauljoin", scale.preds = T, regmult = 1
Expand Down Expand Up @@ -195,7 +204,7 @@ hpoisson.scale <- mean(species.data[, species]) / mean(predict(hpoisson.model, t
hpoisson.abund <- MakeGAMAbundance(
model = hpoisson.model, r.stack = raster.stack, scale.factor = hpoisson.scale,
filename = ""
)
) # This makes a SpatRaster object
hpoisson.cv <- CrossValidateModel(
model = hpoisson.model, model.type = "hgam", data = species.data,
Expand Down

0 comments on commit adde552

Please sign in to comment.