## continue the RLGH example from ?join
example(join)
## fit the MAT model using the squared chord distance measure
swap.mat <- mat(swapdiat, swappH, method = "SQchord")
swap.mat
## model summary
summary(swap.mat)
## fitted values
fitted(swap.mat)
## model residuals
resid(swap.mat)
## draw summary plots of the model
par(mfrow = c(2,2))
plot(swap.mat)
par(mfrow = c(1,1))
## reconstruct for the RLGH core data
rlgh.mat <- predict(swap.mat, rlgh, k = 10)
rlgh.mat
summary(rlgh.mat)
rlgh.Wmat <- predict(swap.mat, rlgh, k = 10, weighted = TRUE)
rlgh.Wmat
summary(rlgh.Wmat)
## plot of pH change in the RLGH
depths <- as.numeric(colnames(rlgh.mat$predictions$apparent$predicted))
n.analogues <- rlgh.mat$predictions$apparent$k
plot(rlgh.mat$predictions$apparent$predicted[n.analogues, ], depths,
ylim = rev(range(depths)),
xlab = "pH",
ylab = "Depth (cm)",
main = "Estimated pH",
type = "l")
Run the code above in your browser using DataLab