pf.nullsim | R Documentation |
Null Simulation of phylofactor object
pf.nullsim(PF, reps, nfactors = NULL, seed = NULL, nullsimFcn = NULL,
output = "ExpVar", col.shuffle = T, row.shuffle = T, ...)
PF |
class phylofactor object from |
reps |
number of replicate null simulations |
nfactors |
number of factors to run for null simulation |
seed |
optional seed for |
nullsimFcn |
Either NULL, the string "shuffle", or a function taking class "phylofactor" object and producing null dataset. Default for |
output |
output to return from each simulation. Must be in |
col.shuffle |
Logical. Whether or not to shuffle the columns of data. Only used if |
row.shuffle |
Logical. Whether or not to shuffle the rows of data. Only used if |
... |
optional arguments to |
library(ape)
library(phylofactor)
set.seed(1)
m=7
n=10
tree <- rtree(m)
X <- rnorm(n)
Data <- rlnorm(m*n) %>% matrix(.,nrow=m)
rownames(Data) <- tree$tip.label
clade <- c('t1','t3','t6')
for (tip in clade){ Data[tip,] <- Data[tip,]*exp(8*X) }
PF <- PhyloFactor(Data,tree,X,nfactors=4)
#nullsim <- phylofactor:::pf.nullsim(PF,10,nfactors=4)
#plot(PF$ExplainedVar,type='l')
#for (nn in 1:10){lines(nullsim[[nn]],col='grey')}
#legend('center',c('Original Data','Null Data'),col=c('black','gray'),lty=c(1,1))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.