[Mattice-commits] r24 - in pkg: R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Nov 13 23:55:51 CET 2008
Author: andrew_hipp
Date: 2008-11-13 23:55:51 +0100 (Thu, 13 Nov 2008)
New Revision: 24
Added:
pkg/man/paintBranches.Rd
Modified:
pkg/R/informationCriterion.R
pkg/R/revisedBatchHansen.R
Log:
various changes
Modified: pkg/R/informationCriterion.R
===================================================================
--- pkg/R/informationCriterion.R 2008-11-13 22:54:06 UTC (rev 23)
+++ pkg/R/informationCriterion.R 2008-11-13 22:55:51 UTC (rev 24)
@@ -1,7 +1,7 @@
informationCriterion <- function(u = NULL, lnL = NULL, K, n = 0, names = NULL) {
## Returns information criterion values + weights for a vector of u or lnL, K (= df), and n (sample size); names for analyses are optional
if(identical(u,NULL)) u <- -2 * lnL
-
+
AIC = vector("numeric", length(u))
BIC = vector("numeric", length(u))
AICc = vector("numeric", length(u))
Modified: pkg/R/revisedBatchHansen.R
===================================================================
--- pkg/R/revisedBatchHansen.R 2008-11-13 22:54:06 UTC (rev 23)
+++ pkg/R/revisedBatchHansen.R 2008-11-13 22:55:51 UTC (rev 24)
@@ -110,14 +110,18 @@
function(tree, data, regimesList, regimeTitles, brown, ...) {
n <- tree at nterm
## set up a matrix that returns lnL, K, sigmasq, theta0, and alpha for every model; thetas will go along into a list that is indexed by model
- variables <- c("loglik", "dof", "sigma.squared", "theta", "alpha") # it's important that 'alpha' go last so that the matrix fills up right when the brownian motion model is used
+ hansenOptima <- list(length(regimeTitles))
+ variables <- c("loglik", "dof", "sigma.squared", "theta / alpha") # it's important that 'alpha' go last so that the matrix fills up right when the brownian motion model is used
+ brVars <- c("loglik", "dof", "sigma.squared", "theta")
+ haVars <- c("loglik", "dof", "sigma.squared", "alpha")
treeData <- matrix(data = NA, nrow = length(regimeTitles), ncol = length(variables), dimnames = list(regimeTitles,variables))
if(brown) br <- brown(data, tree)
- treeData["brown", ] <- unlist(summary(br)[variables])
+ treeData["brown", ] <- unlist(summary(br)[brVars])
for (i in seq(regimesList)) {
message(paste("Running regime",i))
## at this point, the user has to give an initial alpha and sigma for hansen to search on... this should be relaxed
ha = hansen(data, tree, regimesList[[i]], ...)
- treeData[i, ] <- unlist(summary(ha)[variables])
+ treeData[i, ] <- unlist(summary(ha)[haVars])
+ hansenOptima[[i]] <- summary(ha)$optima[[1]]
}
return(treeData) }
\ No newline at end of file
Added: pkg/man/paintBranches.Rd
===================================================================
--- pkg/man/paintBranches.Rd (rev 0)
+++ pkg/man/paintBranches.Rd 2008-11-13 22:55:51 UTC (rev 24)
@@ -0,0 +1,29 @@
+\name{paintBranches}
+\alias{paintBranches}
+\title{Paint branches for Ornstein-Uhlenbeck analysis}
+\description{
+Paints branches with regimes changing at nodes specified. Called by
+\code{regimeVectors}.
+ }
+\usage{
+ function(tree, regimeShiftNodes, regimeTitles)
+ }
+\arguments{
+\item{tree}{An S4 ouchtree object, generated using
+\code{ape2ouch}
+or
+\code{ouchtree}. Old-style ouch trees (data frames) will not work but can be translated using
+\code{ouchtree}.
+}
+\item{regimeShiftNodes}{Nodes at which the selective regime changes.}
+\item{regimeTitles}{Titles for the regimes.}
+}
+\details{
+\code{regimeTitles} is a vector of titles for the regimes that begin at the root and at the nodes indicated in "regimeShiftNodes",
+# in order of description in "regimeShiftNodes", except that the root is listed first in "regimeTitles"
+# but not at all in "regimeShiftNodes"
+}
+\examples{
+}
+
+\keyword{paint}
\ No newline at end of file
More information about the Mattice-commits
mailing list