Commit 7757b438 by Eric Coissac

Add variance partition diagram to the model plot function

parent 433144c8
......@@ -161,10 +161,14 @@ print.pm = function(m,...) {
#' @author Eric Coissac
#' @author Christelle Gonindard-Melodelima
#' @export
plot.pm = function(m,...) {
plot.pm = function(m,
points.cex=0.6,
labels.cex=0.6,
arrow.length=0.05,
asp=1,
...) {
points.cex=0.6
labels.cex=0.6
layout(matrix(c(1,1,1,1,2,3),nrow = 2))
xlim = c(min(m$model[[1]][,1],m$fitted.values[,1]),
max(m$model[[1]][,1],m$fitted.values[,1])
......@@ -178,7 +182,8 @@ plot.pm = function(m,...) {
plot(m$model[[1]][,1:2],
xlim=xlim,ylim=ylim,
cex=points.cex,
col="blue")
col="blue",
asp=asp)
points(m$fitted.values[,1:2],
xlim=xlim,ylim=ylim,
......@@ -187,16 +192,9 @@ plot.pm = function(m,...) {
arrows(m$fitted.values[,1],m$fitted.values[,2],
m$model[[1]][,1],m$model[[1]][,2],
length = 0.05,
length = arrow.length,
col="black")
# text(m$model[[1]][,1],m$model[[1]][,2],
# rownames(m$model[[1]]),
# xlim=xlim,ylim=ylim,
# cex=labels.cex,
# col="blue",
# pos=3)
text(centers[,1],centers[,2],
rownames(m$fitted.values),
xlim=xlim,ylim=ylim,
......@@ -204,6 +202,11 @@ plot.pm = function(m,...) {
col="black",
pos=3)
anova = anova(m)
v=c(anova$SCX,
interaction=anova$SCI,
error=anova$SCE)
barplot(v/sum(v),las=2)
}
anova.pm = function(m,...) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment