Permalink
Browse files

plot method for phyl.RMA object

  • Loading branch information...
1 parent 6fbeb40 commit 55066b85ca687fffd21465deb0c2dd8abf05b668 @liamrevell committed Dec 29, 2016
Showing with 10 additions and 1 deletion.
  1. +1 −0 NAMESPACE
  2. +9 −1 R/phyl.RMA.R
View
@@ -98,6 +98,7 @@ S3method(print, aic.w)
S3method(print, phyl.RMA)
S3method(coef, phyl.RMA)
S3method(residuals, phyl.RMA)
+S3method(plot, phyl.RMA)
importFrom(animation, ani.options, ani.record, ani.replay, saveVideo)
importFrom(ape, .PlotPhyloEnv, .uncompressTipLabel, ace, all.equal.phylo, as.DNAbin, as.phylo, bind.tree, branching.times, collapse.singles)
View
@@ -35,11 +35,13 @@ phyl.RMA<-function(x,y,tree,method="BM",lambda=NULL,fixed=FALSE,h0=1.0){
test<-c(r2,T,df,P); names(test)<-c("r2","T","df","P")
object<-list(RMA.beta=c(beta0,beta1),V=temp$R,lambda=est.lambda,
logL=as.numeric(result$objective),test=test,h0=h0,model=method,
- resid=as.matrix(r))
+ resid=as.matrix(r),data=cbind(x,y),tree=tree)
class(object)<-"phyl.RMA"
object
}
+## S3 methods for "phyl.RMA" object class
+
print.phyl.RMA<-function(x,...){
cat("\nCoefficients:\n")
print(coef(x))
@@ -65,3 +67,9 @@ coef.phyl.RMA<-function(object,...){
}
residuals.phyl.RMA<-function(object,...) object$resid[,1]
+
+plot.phyl.RMA<-function(x,...){
+ phylomorphospace(x$tree,x$data,node.size=c(0,0),ftype="off")
+ points(x$data,cex=1.2,pch=21,bg="grey")
+ abline(a=coef(x)[1],b=coef(x)[2],lwd=2,col="grey")
+}

0 comments on commit 55066b8

Please sign in to comment.