data(IK)
spec <- IK$spec
SumSST <- IK$env$SumSST
core <- IK$core
# Generate a MR model using taxa with max abun > 20%
mx <- apply(spec, 2, max)
spec2 <- spec[, mx > 20]
fit <- MR(spec2, SumSST)
fit
# cross-validate model
fit.cv <- crossval(fit, cv.method="lgo")
fit.cv
#predict the core
pred <- predict(fit, core)
#plot predictions - depths are in rownames
depth <- as.numeric(rownames(core))
plot(depth, pred$fit[, 1], type="b")
if (FALSE) {
# predictions with sample specific errors
# takes approximately 1 minute to run
pred <- predict(fit, core, sse=TRUE, nboot=1000)
pred
}
Run the code above in your browser using DataLab