Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
049fe76
commit 8437afa
Showing
17 changed files
with
136 additions
and
273 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
birthdeathSim <- function(b=.1, d=0, CladeSize, NumberMissing, NumberOfReps){ | ||
v <- vector("list", NumberOfReps); | ||
for (i in 1:NumberOfReps) v[[i]] <- birthdeath.tree(b = 0.1, d = 0, taxa.stop = CladeSize); | ||
v <- lapply(v, old2new.phylo); | ||
v <- lapply(v, drop.tip, as.character(sample(1:(CladeSize), NumberMissing))); | ||
fx <- function(x)return(rev(sort(as.numeric(branching.times(x))))); | ||
v <- lapply(v, fx); | ||
v <- as.matrix(t(as.data.frame(v))); | ||
|
||
return(v); | ||
} | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
|
||
# laser script to fitdAICrc.batch | ||
|
||
|
||
|
||
fitdAICrc.batch <- function(x, observed=NULL, ...){ | ||
rc1 <- apply(x, 1, pureBirth); | ||
rc2 <- apply(x, 1, bd); | ||
rv1 <- apply(x, 1, DDX); | ||
rv2 <- apply(x, 1, DDL); | ||
rv3 <- apply(x, 1, yule2rate, ...); | ||
|
||
res <- matrix(0, nrow=nrow(x), ncol=6); | ||
for (i in 1:nrow(x)){ | ||
res[i, 1] <- rc1[[i]]$aic; | ||
res[i, 2] <- rc2[[i]]$aic; | ||
res[i, 3] <- rv1[[i]]$aic; | ||
res[i, 4] <- rv2[[i]]$aic; | ||
res[i, 5] <- rv3[[i]]$aic; | ||
res[i, 6] <- min(rc1[[i]]$aic, rc2[[i]]$aic) - min(rv1[[i]]$aic, rv2[[i]]$aic, rv3[[i]]$aic); | ||
|
||
} | ||
|
||
colnames(res) <- c('pb', 'bd', 'DDX', 'DDL', 'y2r', 'dAIC'); | ||
res <- as.data.frame(res); | ||
if (!is.null(observed)){ | ||
p.value <- length(res$dAIC[res$dAIC >= observed])/(nrow(res) + 1); | ||
cat('observed dAIC:', observed, '\n', 'p = ', p.value, '\n'); | ||
} | ||
return(res); | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
\name{fitdAICrc.batch} | ||
\alias{fitdAICrc.batch} | ||
|
||
|
||
\title{ Generate Null Distribution of dAICrc} | ||
\description{ | ||
Generates null distribution of dAICrc test statistic and determines significance | ||
of dAICrc indices calculated for 'real' phylogenies. | ||
} | ||
\usage{ | ||
fitdAICrc.batch(x, observed=NULL, ...) | ||
} | ||
|
||
\arguments{ | ||
\item{x}{ a numeric matrix or dataframe of branching times } | ||
\item{observed}{ the dAICrc statistic for the 'real' phylogeny } | ||
\item{...}{ other parameters, e.g., ints for yule2rate } | ||
} | ||
\details{ | ||
For details on input format, see \code{\link{getBtimes.batch}}. | ||
|
||
This fits the following models: pure birth, birth death, density-dependent (exponential), | ||
density-dependent (logistic), yule-2-rate | ||
|
||
|
||
'observed' is the calculated dAICrc statistic obtained for a test phylogeny for which you would like to | ||
obtain a p-value (using \code{\link{fitdAICrc}}). | ||
|
||
} | ||
\value{ | ||
A dataframe with N rows, where N is the number of sets of branching times analyzed. Columns of the data frame | ||
are the AIC scores for each of the models. The final column, with name dAIC, is the deltaAICrc test statistic | ||
for that particular tree. | ||
|
||
} | ||
\references{ | ||
Rabosky, D. L. 2006. Likelihood methods for inferring temporal shifts in | ||
diversification rates. \emph{Evolution} 60:1152-1164. | ||
|
||
} | ||
\author{ Dan Rabosky \email{DLR32@cornell.edu} } | ||
\note{ | ||
Make sure that you are using the exact same set of models for the real phylogeny and for the simulated | ||
phylogenies. If not, your results are invalid. | ||
|
||
} | ||
|
||
\examples{ | ||
|
||
} | ||
\keyword{ models } | ||
\keyword{ htest } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.