require(car)
cpca <- covPCA(iris[,1:4],iris[,5])
sp(cpca$PCscores[,1],cpca$PCscores[,2],groups=levels(iris[,5]),
smooth=FALSE,xlim=range(cpca$PCscores),ylim=range(cpca$PCscores))
data(boneData)
proc <- procSym(boneLM)
pop <- name2factor(boneLM, which=3)
## compare covariance matrices for PCscores of Procrustes fitted data
cpca1 <- covPCA(proc$PCscores, groups=pop, rounds = 100, mc.cores=2)
## view p-values:
cpca1$p.matrix # differences between covariance matrices
# are significant
## visualize covariance ellipses of first 5 PCs of shape
spm(proc$PCscores[,1:5], groups=pop, smooth=FALSE,ellipse=TRUE, by.groups=TRUE)
## covariance seems to differ between 1st and 5th PC
## for demonstration purposes, try only first 4 PCs
cpca2 <- covPCA(proc$PCscores[,1:4], groups=pop, rounds = 100,
mc.cores=2)
## view p-values:
cpca2$p.matrix # significance is gone
Run the code above in your browser using DataLab