dat <- box.cork
pairs(dat[,2:5], xlim=c(25,100), ylim=c(25,100))
## Each tree is one line
require(plotrix)
radial.plot(dat[, 2:5], start=pi/2, rp.type='p', clockwise=TRUE,
radial.lim=c(0,100),
lwd=2, labels=c('North','East','South','West'),
line.col=rep(c("royalblue","red","#009900","dark orange",
"#999999","#a6761d","deep pink"), length=nrow(dat)))
require(reshape2)
dat$tree <- factor(dat$tree)
d2 <- melt(dat)
names(d2) <- c('tree','dir','y')
require(asreml)
d2 <- d2[order(d2$tree, d2$dir), ]
# Unstructured covariance matrix
m1 <- asreml(y~dir, data=d2, rcov=~tree:us(dir, init=rep(200,10)))
## Note: 'rcor' is a personal function to extract the correlation
## round(rcor(m1)$dir, 2)
## N E S W
## N 290.41 223.75 288.44 226.27
## E 223.75 219.93 229.06 171.37
## S 288.44 229.06 350.00 259.54
## W 226.27 171.37 259.54 226.00
# Factor Analytic with different specific variances
# Note: Wolfinger used a common diagonal variance
m2 <- update(m1, rcov=~tree:facv(dir,1))
## round(rcor(m2)$dir, 2)
## N E S W
## N 290.42 209.46 291.82 228.44
## E 209.46 219.95 232.85 182.28
## S 291.82 232.85 350.00 253.95
## W 228.44 182.28 253.95 225.99Run the code above in your browser using DataLab