# \dontshow{
od <- options(digits = 4)
# }
## symmetric CoCA
data(beetles)
## log transform the bettle data
beetles <- log(beetles + 1)
data(plants)
## fit the model
bp.sym <- coca(beetles ~ ., data = plants, method = "symmetric")
bp.sym
summary(bp.sym)
biplot(bp.sym) # produces a Benzecri biplot
## extract eigenvalues of the analysis
eigenvals(bp.sym)
## correlations between beetle and plant score scores on Co-CA axes
corAxis(bp.sym)
## predictive CoCA using SIMPLS and formula interface
bp.pred <- coca(beetles ~ ., data = plants)
## should retain only the useful PLS components for a parsimonious model
# \donttest{
## Leave-one-out crossvalidation - this takes a while
crossval(beetles, plants)
## so 2 axes are sufficient
## permutation test to assess significant PLS components - takes a while
bp.perm <- permutest(bp.pred, permutations = 99)
bp.perm
# }
## agrees with the Leave-one-out cross-validation
## refit the model with only 2 PLS components
bp.pred <- coca(beetles ~ ., data = plants, n.axes = 2)
bp.pred
summary(bp.pred)
biplot(bp.pred) # plots correct scores or loadings
## predictive CoCA using Eigen-analysis
data(bryophyte)
data(vascular)
carp.pred <- coca(y = bryophyte, x = vascular, reg.method = "eigen")
carp.pred
# \donttest{
## determine important PLS components - takes a while
crossval(bryophyte, vascular)
(carp.perm <- permutest(carp.pred, permutations = 99))
# }
## 2 components again, refit
carp.pred <- coca(y = bryophyte, x = vascular,
reg.method = "eigen", n.axes = 2)
carp.pred
## drawn biplot
biplot(carp.pred)
options(od)
Run the code above in your browser using DataLab