pf.predict: Predicts based on phylofactorization

Description Usage Arguments Value Examples

View source: R/pf.predict.R

Description

Predicts based on phylofactorization

Usage

1
pf.predict(PF, factors = NULL, ...)

Arguments

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

Value

estimated data based on estimates from phylofactorization

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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))

reptalex/phylofactor documentation built on Oct. 19, 2018, 7:22 p.m.