pf.predict | R Documentation |
Predicts based on phylofactorization
pf.predict(PF, factors = NULL, ...)
PF |
PhyloFactor object |
factors |
Set of factors to be used for prediction. Currently, must be a continuous integer sequence from 1:nfactors |
... |
optional input arguments for predict |
estimated data based on estimates from phylofactorization
library(caper)
set.seed(1)
tree <- unroot(rtree(8))
Data <- matrix(rlnorm(80),nrow=8)
rownames(Data) <- tree$tip.label
Grp <- clade.members.list(tree)$'12'
for (gg in Grp){
Data[gg,] <- Data[gg,]*20^(seq(-1,1,length.out=10))
}
X <- 1:10
colnames(Data) <- X
Data <- clo(Data)
rownames(Data) <- tree$tip.label
PF <- PhyloFactor(Data,tree,X,nfactors=1)
CommunityEst <- pf.predict(PF,factors=1,newdata=data.frame(X=seq(0,11,by=1/3)))
rownames(CommunityEst) <- rownames(Data)
clr <- function(A) apply(A,MARGIN=2,FUN=function(a) log(a)-mean(log(a)))
pf.heatmap(tree=tree,Data=clr(Data))
pf.heatmap(tree=tree,Data=clr(CommunityEst))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.