Skip to content

Commit

Permalink
fix error in 10a solutions predictions
Browse files Browse the repository at this point in the history
  • Loading branch information
doserjef committed Jun 27, 2024
1 parent 941a6cf commit 1965dc6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion code/10a-solutions-spatial-glmm-birds.R
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ summary(out.non.sp.nb)
# and tuning variances should again be adequate.

# Model 3: Spatial Poisson ------------
# Number of samples per chain
(n.batch * batch.length - n.burn) / n.thin
# Total samples
((n.batch * batch.length - n.burn) / n.thin) * n.chains
out.sp.p <- spAbund(formula = ~ scale(tcc) + scale(elev) + I(scale(elev)^2) +
scale(ppt) + scale(day) + I(scale(day)^2) +
(1 | obs),
Expand Down Expand Up @@ -219,7 +223,7 @@ str(pred.df)
coords.0 <- as.matrix(pred.df[, c('x', 'y')])
# Standardize the covariates by their appropriate means and sds
tcc.pred <- (pred.df$tcc - mean(data.NOCA$covs$tcc)) / sd(data.NOCA$covs$tcc)
elev.pred <- (pred.df$tcc - mean(data.NOCA$covs$tcc)) / sd(data.NOCA$covs$tcc)
elev.pred <- (pred.df$elev - mean(data.NOCA$covs$elev)) / sd(data.NOCA$covs$elev)
elev.2.pred <- elev.pred^2
ppt.pred <- (pred.df$ppt - mean(data.NOCA$covs$ppt)) / sd(data.NOCA$covs$ppt)
# Set day to 0
Expand Down

0 comments on commit 1965dc6

Please sign in to comment.