[Mattice-commits] r223 - pkg/man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Sep 8 17:12:28 CEST 2009
Author: andrew_hipp
Date: 2009-09-08 17:12:28 +0200 (Tue, 08 Sep 2009)
New Revision: 223
Modified:
pkg/man/regimeMaker.Rd
pkg/man/regimeMatrix.Rd
Log:
completed documentation for regimeMaker and regimeMatrix
Modified: pkg/man/regimeMaker.Rd
===================================================================
--- pkg/man/regimeMaker.Rd 2009-09-04 19:24:09 UTC (rev 222)
+++ pkg/man/regimeMaker.Rd 2009-09-08 15:12:28 UTC (rev 223)
@@ -2,48 +2,50 @@
\Rdversion{1.1}
\alias{regimeMaker}
\title{
- Returns ouch-style regimes defined by a matrix, with each row specifying which nodes permit character transitions
+ Paint ouch-style regimes over a set of trees based on a user-defined matrix
}
\description{
- This function utilizes a matrix of the format returned by \code{regimeMatrix}
+ This function utilizes a matrix of the format returned by \code{regimeMatrix} to define the models it is going to create. Then, it paints these models onto the trees provided and returns a list suitable for further analysis.
}
\usage{
regimeMaker(ouchTrees, regMatrix, nodeMembers)
}
-%- maybe also 'usage' for other objects documented here.
\arguments{
\item{ouchTrees}{
-%% ~~Describe \code{ouchTrees} here~~
-}
+ A list of \pkg{ouch}-style trees
+ }
\item{regMatrix}{
-%% ~~Describe \code{regMatrix} here~~
-}
+ A model by nodes matrix of the format returned by \code{regimeMatrix}
+ }
\item{nodeMembers}{
-%% ~~Describe \code{nodeMembers} here~~
+ A list of individuals defining the nodes specified in \code{regMatrix}
+ }
}
-}
\details{
-%% ~~ If necessary, more details than the description above ~~
+ The easiest way to use this function will usually be to utilize \code{regimeMatrix} to create the matrix input as \code{regMatrix} and manually prune or add rows. See the example below.
}
\value{
-%% ~Describe the value returned
-%% If it is a LIST, use
-%% \item{comp1 }{Description of 'comp1'}
-%% \item{comp2 }{Description of 'comp2'}
-%% ...
+ A list with three items:
+ \item{regList}{
+ A list of lists of regimes, with the number of first-order items corresponding to the number of trees in \code{ouchTrees},
+ the number of second-order items corresponding to the number of models being tested.
+ In the example below, \code{regs$regList[[2]][[4]]} is the fourth model defined on the second tree.
+ }
+ \item{nodeMatrix}{
+ A boolean matrix with rows corresponding to the trees in \code{ouchTrees} and columns corresponding to the nodes specified in \code{regMatrix};
+ cells indicate by \code{TRUE} or \code{FALSE} whether a node is present in each of the trees being analyzed.
+ }
+ \item{regMatrix}{
+ A list of \code{regimeMatrix}-format matrices that define the models applicable for each tree in \code{ouchTrees}, with missing nodes designated by NAs.
+ }
}
-\references{
-%% ~put references to the literature/web site here ~
-}
\author{
-%% ~~who you are~~
+ Andrew L. Hipp <ahipp at mortonarb.org>
}
\note{
-%% ~~further notes~~
+ Use of \code{regimeMatrix} or \code{regimeMaker} to generate tailored sets of regimes is not currently integrated smoothly with \code{runBatchHansen},
+ but for the time being they can be used to create regimes for manual analysis.
}
-
-%% ~Make other sections like Warning with \section{Warning }{....} ~
-
\seealso{
\code{\link{regimeMatrix}}, \code{\link{paintBranches}}
}
@@ -53,10 +55,11 @@
trees <- lapply(carex$ovales.bayesTrees[1:10], ape2ouch)
# if we are interested in comparing the single-change models that allow changes only at nodes 1, 2, 4, 5, and 8, as well as the no-change model, we could do:
mat <- regimeMatrix(n = 8, maxNodes = 1)[c(1,2,4,5,8,9), ] # the 9th row is the no-change model
+ #... then we make regimes based on that regime matrix...
regs <- regimeMaker(trees, mat, carex$ovales.nodes)
-
+ #... and paint the regimes from tree 1 onto tree 1 either singly...
+ plot(trees[[1]], regime = regs$regList[[1]][[1]])
+ #... or in a layout:
+ plot(trees[[1]], regime = regs$regList[[1]])
}
-% Add one or more standard keywords, see file 'KEYWORDS' in the
-% R documentation directory.
-\keyword{ ~kwd1 }
-\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line
+\keyword{ models }
\ No newline at end of file
Modified: pkg/man/regimeMatrix.Rd
===================================================================
--- pkg/man/regimeMatrix.Rd 2009-09-04 19:24:09 UTC (rev 222)
+++ pkg/man/regimeMatrix.Rd 2009-09-08 15:12:28 UTC (rev 223)
@@ -2,27 +2,28 @@
\Rdversion{1.1}
\alias{regimeMatrix}
\title{
-%% ~~function to do ... ~~
+ Create a matrix that defines models for batch analysis
}
\description{
\code{regimeMatrix} is a recursive function that returns a matrix of n columns by k rows, where n is a number
of items and k is the number of all possible permutations of those items, up to a maximum number of items
defined by \code{maxNodes}, and including a row with zero items.
-}
+ }
\usage{
-regimeMatrix(n, maxNodes)
-}
+ regimeMatrix(n, maxNodes)
+ }
\arguments{
\item{n}{
- An integer between 1 and \code{maxNodes}
-}
+ An integer between 1 and \code{maxNodes}
+ }
\item{maxNodes}{
- An integer between 1 and n; at \code{n} = \code{maxNodes}, \code{regimeMatrix} will return a matrix of 2^\code{n} rows.
-}
-}
+ An integer between 1 and n; at \code{n} = \code{maxNodes}, \code{regimeMatrix} will return a matrix of 2^\code{n} rows.
+ }
+ }
\details{
Typically, this function is called by \code{regimeVectors},
- but it may be useful to call this function if you are interested in definining a
+ but it may be useful to call this function if you are interested in defining an arbitrary set of models
+ that doesn't include all possible models in the
}
\value{
A matrix of n columns by k rows, where n is a number
@@ -34,42 +35,18 @@
}
\author{
Andrew Hipp \email{ahipp at mortonarb.org}
-}
+ }
\note{
-%% ~~further notes~~
-}
+ Use of \code{regimeMatrix} or \code{regimeMaker} to generate tailored sets of regimes is not currently integrated smoothly with \code{runBatchHansen},
+ but for the time being they can be used to create regimes for manual analysis.
+ }
\seealso{
\code{\link{regimeMaker}}, \code{\link{paintBranches}}
-}
+ }
\examples{
-##---- Should be DIRECTLY executable !! ----
-##-- ==> Define data, use random,
-##-- or do help(data=index) for the standard data sets.
-
-## The function is currently defined as
-function (n, maxNodes)
-{
- if (n == 1)
- return(matrix(1:0, nrow = 2, ncol = 1))
- outmat <- matrix(NA, nrow = 0, ncol = n)
- for (i in 1:(n - 1)) {
- temp <- c(rep(0, (i - 1)), 1)
- remainder <- n - i
- if (maxNodes > 1 && remainder > 0) {
- nextMat <- regimeMatrix(remainder, maxNodes - 1)
- temp <- cbind(matrix(temp, dim(nextMat)[1], length(temp),
- byrow = TRUE), nextMat)
- }
- else temp[(i + 1):n] <- rep(0, length((i + 1):n))
- outmat <- rbind(outmat, temp)
- }
- outmat <- rbind(outmat, c(rep(0, n - 1), 1))
- outmat <- rbind(outmat, rep(0, n))
- dimnames(outmat) = list(seq(dim(outmat)[1]), seq(dim(outmat)[2]))
- return(outmat)
+ # evaluating a set of models allowing all possible permutations of changes at 15 nodes will be quite time-consuming:
+ print(paste("Number of models =", dim(regimeMatrix(15,15))[1]))
+ # paring that down to all possible permutations of changes at 15 nodes, up to a maximum of 5 changes, is much more manageable:
+ print(paste("Number of models =", dim(regimeMatrix(15,5))[1]))
}
-}
-% Add one or more standard keywords, see file 'KEYWORDS' in the
-% R documentation directory.
-\keyword{ ~kwd1 }
-\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line
+\keyword{models}
\ No newline at end of file
More information about the Mattice-commits
mailing list