Skip to contents

Perform simple predictions from a pre-fit SDM model

Load the previously fit SDM model

Predict to previously observed locations

# Predict at 1-year forecast horizon
horizon <- 1

inSamplePred <- scoreSDM()

# plot the predictions and observations

What about a different forecast horizon?

# Predict at 3-year forecast horizon
horizon <- 3

inSamplePred <- scoreSDM()

# plot the predictions and observations

Predict to the full spatial surface

# construct a mesh of evenly-spaced points within the sample frame
#!!RW: I think this is what Nerea did in 3_Predict_native.R

Compare the skill for each prediction

# also compare to a persistence assumption

# Call testSkillSDM to assess the skill of the X-year forecast for this SDM
sdmSkill <- testSkillSDM(mod = mod, targetName = targetName, aucCutoff = aucCutoff, usePersistence = FALSE)
# Add noYrs and sdmType to output
sdmSkill$noYrsTrain <- noYrs
sdmSkill$terminalYr <- max(subObs$year) - yrsToForecast 
sdmSkill$sdmType <- sdmType
  
# spatial plot of difference in prediction skill and observations