Evolutionary constrain parameter tom plot (for OU model only). Leave as "NULL" to implement the BM model
time.span
A vector of length 1 if the expectation is calcuated for a single time; length 2 if to be calculated over a range from 0 to an upper value chosen by the user; or length > 0, where the user supplies 3 or more times over which to calculate the Expectation.
values
TRUE (null) returns the values in matrix form.
plot
Plot the expected (solid line) Euclidean distance and optionally quantiles for a given Beta.
quantile
Calculate (and optionally plot) the expected quantiles (0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.95, 0.99) for Euclidean distances under a given Beta.
Details
This function calculates the expectation (i.e. mean value under a half normal distribution) for Eculidean distance across a time range and optionally the quantiles (0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.95, 0.99).
Value
Returns a matrix with 3 columns corresponding to L, T and simulated E, and an additional 11 columns with quantiles if qualtiles=TRUE. If plot=TRUE, the expectation (solid line) and optionally the quantiles (dashed lines) are plotted.
Author(s)
Jason T. Weir
References
Weir JT, D Wheatcroft, & T Price. 2012. The role of ecological constraint in driving the evolution of avian song frequency across a latitudinal gradient. Evolution 66, 2773-2783.
Weir JT, & D Wheatcroft. 2011. A latitudinal gradient in rates of evolution of avian syllable diversity and song length. Proceedings of the Royal Society of London, B 278, 1713-1720.
##Example 1
###Compare data simulated under BM_null to the expectation and quantiles
TIME = c(0:100) * 0.1
GRAD = (0:100)*0 #BM_null does not require GRAD, thus simply make a dummy set of GRAD
DATA1 <- sim.sisters(TIME=TIME, GRAD=GRAD, parameters = c(0.1),
model=c("BM_null"), MULT=10)
expectation.time(Beta=0.1, Alpha="NULL", time.span=c(0, 10), values=FALSE,
plot=TRUE, quantile=TRUE)
points(DATA1[,3] ~ DATA1[,2], col="black", cex=0.4)
##Example 2
###Compare data simulated under OU_null to the expectation and quantiles
TIME = c(0:100) * 0.1
GRAD = (0:100)*0 #GRAD is not required by these models, so a dummy set of GRAD are provided
DATA1 <- sim.sisters(TIME=TIME, GRAD=GRAD, parameters = c(0.1, 1),
model=c("OU_null"), MULT=10)
expectation.time(Beta=0.1, Alpha=1, time.span=c(0, 10), values=FALSE,
plot=TRUE, quantile=TRUE)
points(DATA1[,3] ~ DATA1[,2], col="black", cex=0.4)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(EvoRAG)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/EvoRAG/expectation.time.Rd_%03d_medium.png", width=480, height=480)
> ### Name: expectation.time
> ### Title: calculate the expected (i.e. mean) Euclidean distances through
> ### time given a rate of evolution, Beta.
> ### Aliases: expectation.time
> ### Keywords: Expectation
>
> ### ** Examples
>
> ##Example 1
> ###Compare data simulated under BM_null to the expectation and quantiles
> TIME = c(0:100) * 0.1
> GRAD = (0:100)*0 #BM_null does not require GRAD, thus simply make a dummy set of GRAD
> DATA1 <- sim.sisters(TIME=TIME, GRAD=GRAD, parameters = c(0.1),
+ model=c("BM_null"), MULT=10)
> expectation.time(Beta=0.1, Alpha="NULL", time.span=c(0, 10), values=FALSE,
+ plot=TRUE, quantile=TRUE)
> points(DATA1[,3] ~ DATA1[,2], col="black", cex=0.4)
>
> ##Example 2
> ###Compare data simulated under OU_null to the expectation and quantiles
> TIME = c(0:100) * 0.1
> GRAD = (0:100)*0 #GRAD is not required by these models, so a dummy set of GRAD are provided
> DATA1 <- sim.sisters(TIME=TIME, GRAD=GRAD, parameters = c(0.1, 1),
+ model=c("OU_null"), MULT=10)
> expectation.time(Beta=0.1, Alpha=1, time.span=c(0, 10), values=FALSE,
+ plot=TRUE, quantile=TRUE)
> points(DATA1[,3] ~ DATA1[,2], col="black", cex=0.4)
>
>
>
>
>
> dev.off()
null device
1
>