Description Usage Arguments Value References Examples
Constant Volatility Test for WFP
1 2 |
ntests |
Positive integer - number of randomly selected constant-volatility transformations (CVTs) for heteroskedasticity testing |
R |
Compositional matrix - columns must be species and rows timepoints. |
regress |
Either "f" or "t" - whether regrssion should be performed on the state of the CVT or on the time. |
formula |
Formula for regression of the jumps in CVTs vs time or state of cvts. Should be in form "DF ~ f" or "DF ~ tm + I(tm^2)" or etc. Default is quadratic regression |
tm |
Input vector of timpoints to be used if |
varformla |
Input argument for |
vector of p-values from Bruesh-Pagan heteroskedasticity tests.
http://biorxiv.org/content/early/2016/03/18/044495
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | library(plotrix)
library(WrightFisher)
set.seed(2)
#this may take ~20-30 seconds
X <- wfp(nSpecies=15,lambda=25)
t <- X$time
R <- X$Community
par(mfrow=c(1,3))
stackpoly(R,stack=T,main='Community Dynamics',xlab='time',ylab='Abundance')
Pvalsf <- CVTest(100,R)
Pvalst <- CVTest(100,R,regress='time')
plot(ecdf(Pvalsf),xlab='P',ylab='#',main='P-values from regress="f"')
lines(c(0,1),c(0,1),lwd=4,col='blue')
plot(ecdf(Pvalst),xlab='P',ylab='#',main='P-values from regress="time"')
lines(c(0,1),c(0,1),lwd=4,col='blue')
#Uncorrected KS test - the P-value from the KS-test gives a comparable estimate of the incompatibility of the simulation with a WFP
ks <- ks.test(Pvalsf,runif(length(Pvalsf)))
ks$p.value
ks.test(Pvalst,runif(length(Pvalst)))$p.value
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.