8.2 Prepare the plankton data
We will prepare the data by z-scoring. The original data lakeWAplanktonTrans
were already z-scored, but we changed the mean when we subsampled the years so we need to z-score again.
# z-score the response variables
<- apply(dat, 1, mean, na.rm = TRUE)
the.mean <- sqrt(apply(dat, 1, var, na.rm = TRUE))
the.sigma <- (dat - the.mean) * (1/the.sigma) dat
Next we set up the covariate data, temperature and total phosphorous. We z-score the covariates to standardize and remove the mean.
<- apply(covariates, 1, mean, na.rm = TRUE)
the.mean <- sqrt(apply(covariates, 1, var, na.rm = TRUE))
the.sigma <- (covariates - the.mean) * (1/the.sigma) covariates