if (FALSE) {
# See examples for lm.rrpp to see how predict.lm.rrpp works in conjunction
# with other functions
data(Pupfish)
# CS is centroid (fish) size
fit <- lm.rrpp(coords ~ log(CS) + Sex*Pop,
SS.type = "I", data = Pupfish, iter = 999)
# Predictions (holding alternative effects constant)
shapeDF <- expand.grid(Sex = levels(Pupfish$Sex), Pop = levels(Pupfish$Pop))
rownames(shapeDF) <- paste(shapeDF$Sex, shapeDF$Pop, sep = ".")
shapeDF
shapePreds <- predict(fit, shapeDF)
summary(shapePreds)
summary(shapePreds, PC = TRUE)
shapePreds99 <- predict(fit, shapeDF, confidence = 0.99)
summary(shapePreds99, PC = TRUE)
# Plot prediction
plot(shapePreds, PC = TRUE)
plot(shapePreds, PC = TRUE, ellipse = TRUE)
plot(shapePreds99, PC = TRUE)
plot(shapePreds99, PC = TRUE, ellipse = TRUE)
}
Run the code above in your browser using DataLab