Skip to content

Commit

Permalink
version 2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Rabosky authored and gaborcsardi committed Sep 21, 2008
1 parent 049fe76 commit 8437afa
Show file tree
Hide file tree
Showing 17 changed files with 136 additions and 273 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
@@ -1,6 +1,6 @@
Package: laser
Version: 2.1
Date: 2007-5-20
Version: 2.2
Date: 2008-9-21
Title: Likelihood Analysis of Speciation/Extinction Rates from Phylogenies
Author: Dan Rabosky
Maintainer: Dan Rabosky <DLR32@cornell.edu>
Expand All @@ -9,4 +9,4 @@ Suggests:
Description: laser implements maximum likelihood methods based on the birth-death
process to test whether diversification rates have changed over time and whether rates vary among lineages.
License: GPL 2 or later
Packaged: Sun May 25 21:16:25 2008; hornik
Packaged: Sun Sep 21 09:47:21 2008; danrabosky
73 changes: 0 additions & 73 deletions R/Irvbd.R

This file was deleted.

15 changes: 15 additions & 0 deletions R/birthdeathSim.R
@@ -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);
}




2 changes: 1 addition & 1 deletion R/fitdAICrc.R
@@ -1,5 +1,5 @@
`fitdAICrc` <-
function(x, modelset = c("pureBirth", "bd", "DDL", "DDX", "yule2rate", "rvbd"), ints = NULL)
function(x, modelset = c("pureBirth", "bd", "DDL", "DDX", "yule2rate"), ints = NULL)
{
checkbasal(x)
if (!is.numeric(x)) stop("object x not of class 'numeric'")
Expand Down
52 changes: 52 additions & 0 deletions R/fitdAICrc.batch.R
@@ -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);
}





















87 changes: 0 additions & 87 deletions R/rvbd.R

This file was deleted.

2 changes: 1 addition & 1 deletion man/DensityDependent.Rd
Expand Up @@ -46,7 +46,7 @@ revealed from molecular phylogenies. \emph{Proc. Natl. Acad. Sci. USA} 89:8322-8
}
\author{ Dan Rabosky \email{DLR32@cornell.edu} }

\seealso{ \code{\link{yule-n-rate}}, \code{\link{rvbd}}, \code{\link{fitdAICrc}} }
\seealso{ \code{\link{yule-n-rate}}, \code{\link{fitdAICrc}} }
\examples{
data(plethodon)
resX <- DDX(plethodon)
Expand Down
2 changes: 1 addition & 1 deletion man/bd.Rd
Expand Up @@ -47,7 +47,7 @@ Nee, S., R. M. May, and P. H. Harvey. 1994b. The reconstructed evolutionary pr
}
\author{ Dan Rabosky \email{DLR32@cornell.edu} }

\seealso{ \code{\link{pureBirth}}, \code{\link{fitdAICrc}},\code{\link{yule-n-rate}},\code{\link{rvbd}}}
\seealso{ \code{\link{pureBirth}}, \code{\link{fitdAICrc}},\code{\link{yule-n-rate}}}
\examples{
data(plethodon)
result <- bd(plethodon)
Expand Down
1 change: 1 addition & 0 deletions man/birthdeathSim.Rd
@@ -0,0 +1 @@
\name{birthdeathSim}\alias{birthdeathSim}\title{ birthdeathSim }\description{ Simulate Branching Times Under the birth-death model and/or with incomplete sampling}\usage{birthdeathSim(b, d, CladeSize, NumberMissing, NumberOfReps)}\arguments{ \item{b}{ the speciation rate } \item{d}{ the extinction rate } \item{CladeSize}{ the true clade size you wish to simulate } \item{NumberMissing}{ the number of taxa missing from the 'real' tree } \item{NumberOfReps}{ the number of phylogenies to simulated }}\details{ This generates a matrix of branching times that can be used with \code{fitdAICrc.batch} under any parameterization of a general birth-death model with or without incomplete sampling. To simulate a clade with incomplete sampling, note that \code{CladeSize} is the true size of a phylogeny, and \code{NumberMissing} is the number of missing taxa, so if you specified \code{CladeSize = 100} and \code{NumberMissing = 20}, your resulting trees would have 80 tips (Trees with 100 tips would be simulated, but then 20 taxa would be dropped randomly to simulate incomplete sampling). THis function is basically a wrapper for the \code{birthdeath.tree} function from Geiger, but makes it more amenable to calculation of the delta AIC test statistic for detecting temporal changes in diversification rates. }\value{ an n x m matrix of branching times, where n is size \code{CladeSize} - \code{NumberMissing} and m is size \code{ NumberOfReps }.}\author{ Dan Rabosky \email{DLR32@cornell.edu} }\examples{}\keyword{ datagen }
Expand Down
2 changes: 1 addition & 1 deletion man/calcLHbd.Rd
Expand Up @@ -34,7 +34,7 @@ Nee, S., R. M. May, and P. H. Harvey. 1994b. The reconstructed evolutionary pr
}
\author{ Dan Rabosky \email{DLR32@cornell.edu} }

\seealso{ \code{bd}, \code{rvbd}, \code{pureBirth} }
\seealso{ \code{bd}, \code{pureBirth} }
\examples{

#plot a likelihood surface for the plethodon dataset
Expand Down
9 changes: 5 additions & 4 deletions man/fitdAICrc.Rd
Expand Up @@ -8,8 +8,7 @@
in AIC scores between the best rate-constant and rate-variable models.
}
\usage{
fitdAICrc(x, modelset = c("pureBirth", "bd", "DDL", "DDX", "yule2rate",
"rvbd"), ints = NULL)
fitdAICrc(x, modelset = c("pureBirth", "bd", "DDL", "DDX", "yule2rate"), ints = NULL)
}
\arguments{
\item{x}{ a numeric vector of branching times }
Expand All @@ -22,12 +21,14 @@ fitdAICrc(x, modelset = c("pureBirth", "bd", "DDL", "DDX", "yule2rate",

\code{modelset} is a list of the rate-constant and rate-variable models to consider. You should include
both rate-constant models (\code{\link{pureBirth}} and \code{\link{bd}}), as well as one or more candidate rate-variable
models. Available options are \code{\link{DDX}}, \code{\link{DDL}}, \code{\link{yule2rate}}, \code{\link{rvbd}}, and \code{\link{yule3rate}}.
models. Available options are \code{\link{DDX}}, \code{\link{DDL}}, \code{\link{yule2rate}}, and \code{\link{yule3rate}}.
See full descriptions of each of these models this document.

'ints' is used in determining the number of shift points to consider. If 'ints = NULL' (the
default), the model will consider only observed branching times as possible shift points. See
\code{\link{yule-n-rate}} for additional discussion of the 'ints' option.
\code{\link{yule-n-rate}} for additional discussion of the 'ints' option. ]

Note that the rvbd function is no longer suppored ('rate variable birth death').

}
\value{
Expand Down
52 changes: 52 additions & 0 deletions man/fitdAICrc.batch.Rd
@@ -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 }
1 change: 0 additions & 1 deletion man/laser-internals.Rd
Expand Up @@ -3,7 +3,6 @@
\alias{yuleint2}
\alias{combinations}
\alias{Ibd}
\alias{Irvbd}
\alias{IDDX}
\alias{IDDL}
\alias{IpureBirth}
Expand Down
4 changes: 2 additions & 2 deletions man/laser-package.Rd
Expand Up @@ -12,8 +12,8 @@ LASER
\tabular{ll}{
Package: \tab laser\cr
Type: \tab Package\cr
Version: \tab 2.0\cr
Date: \tab 2008-05-19\cr
Version: \tab 2.2\cr
Date: \tab 2008-09-21\cr
License: \tab GPL 2.0 ? \cr
LazyLoad: \tab yes\cr
}
Expand Down
2 changes: 1 addition & 1 deletion man/pureBirth.Rd
Expand Up @@ -30,7 +30,7 @@ of Dr. J. C. Willis. \emph{Phil. Trans. R. Soc. Lond. B} 213:21-87.
}
\author{ Dan Rabosky \email{DLR32@cornell.edu} }

\seealso{ \code{\link{yule-n-rate}}, \code{\link{bd}}, \code{\link{yuleWindow}}, \code{\link{rvbd}} }
\seealso{ \code{\link{yule-n-rate}}, \code{\link{bd}}, \code{\link{yuleWindow}} }
\examples{
data("plethodon")
### loads branching times for plethodontid salamander dataset
Expand Down

0 comments on commit 8437afa

Please sign in to comment.