diff --git a/DESCRIPTION b/DESCRIPTION index 6df12fc..459dc11 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: ouch Type: Package Title: Ornstein-Uhlenbeck Models for Phylogenetic Comparative Hypotheses -Version: 2.16-5 -Date: 2021-05-06 +Version: 2.16-7 +Date: 2021-05-09 Authors@R: c(person(given=c("Aaron","A."),family="King",role=c("aut","cre"),email="kingaa@umich.edu"), person(given=c("Marguerite","A."),family="Butler",role=c("ctb"))) Maintainer: Aaron A. King diff --git a/R/anolis.R b/R/anolis.R index 6d9d7c1..b027857 100644 --- a/R/anolis.R +++ b/R/anolis.R @@ -8,9 +8,9 @@ #' Size dimorphism was calcuated as the log-ratio of male snout-to-vent length to female snout-to-vent length (males are larger). #' #' In this example, we tested three models of evolution: -#' Brownian motion, Ornstein-Uhlenbeck with one global optimum, and Ornstein-Uhlenbeck with 7 optima (one for each ecomorph type plus an additional one for an "unknown" type). +#' Brownian motion, Ornstein-Uhlenbeck with one global optimum, and Ornstein-Uhlenbeck with seven optima (one for each ecomorph type plus an additional one for an "unknown" type). #' -#' For the 7-optima model, we assigned each terminal branch to an optimum according to the ecomorph type of the extant species. +#' For the seven-optima model, we assigned each terminal branch to an optimum according to the ecomorph type of the extant species. #' Because we had no information to help guide hypotheses about internal branches, we assigned #' internal branches to the "unknown" selective regime. #' The phylogeny of these species is consistent with and adaptive radiation, with a burst of speciation events early in the evolutionary history of this clade (see phylogeny in Butler & King (2004) or example below). @@ -24,7 +24,7 @@ #' - `node`: Labels for the nodes. #' - `species`: Names of extant species. #' - `log.SSD`: Log sexual size dimorphism of extant species. -#' - `ancestor`: Ancestor node. +#' - `ancestor`: Name of ancestor node. #' - `time`: Time of node. #' - `OU.1`: a factor with one level, `ns`. #' - `OU.7`: a factor with levels corresponding to ecomorph (`tg`, `tc`, `gb`, `cg`, `tw`, `tr`, `anc`). diff --git a/R/bimac.R b/R/bimac.R index 09ade41..c1567fe 100644 --- a/R/bimac.R +++ b/R/bimac.R @@ -5,7 +5,7 @@ #' The data frame has the following columns: #' `species` which are species names, #' `size` which is the phenotypic data, -#' and the variables `ancestor` and `time` which specify the topology of the phylogeny and the location of the nodes in time, respectively. +#' and the variables `node`, `ancestor`, and `time` which specify the topology of the phylogeny and the location of the nodes in time, respectively. #' The columns `OU.1`, `OU.3`, `OU.4`, and `OU.LP` specify four hypothetical arrangements of selective regimes. #' Explanations of the data follow: #' \describe{ @@ -14,31 +14,36 @@ #' In this group of lizards, head length correlates very strongly with snout-to-vent length and the cube root of mass, which are standard measures of body size. #' The data are head lengths in mm; note that we use the log of this value in analyses. #' } -#' \item{Tree topology}{ -#' The tree topology is encoded via two vectors: `ancestor` and `time`. -#' Each node of the' phylogenetic tree has a corresponding row in the data frame, numbered from 1 to 45. -#' The columns `ancestor` and `time` specify the phylogeny. -#' The `ancestor` variable specifies the topology: it is a list indicating the ancestor of each node. -#' The root node has ancestor 0. -#' The variable `time` specifies the temporal location of each node, with the root node being at time 0. +#' \item{Tree structure}{ +#' The phylogenetic tree is encoded via three variables: +#' `node`, `ancestor`, and `time`. +#' The `node` variable gives a name to each node. +#' The `ancestor` variable names the ancestor of each node. +#' The root node has no ancestor (i.e., \code{ancestor=NA}). +#' The variable `time` specifies the temporal location of each node, the root node being at time 0. #' } #' \item{Specifications of selective regimes.}{ #' (Columns `OU.1`, `OU.3`, `OU.4`, `OU.LP`). -#' These columns are factors, the levels of which correspond to the "paintings" of the respective adaptive regime hypotheses onto the phylogeny (see [paint()]). +#' These columns are factors, the levels of which correspond to the \dQuote{paintings} of the respective adaptive regime hypotheses onto the phylogeny (see [paint()]). #' Each selective regime is named (small, medium, large, etc.). #' Each column corresponds to a different painting of the selective regimes, and thus to a different hypothesis. #' In this example, there are 3 alternative models (see Butler & King 2004): `OU.4` is 4-regime model, `OU.3` is 3-regime model (all ancestors are medium), `OU.LP` is the linear parsimony model. #' } +#' \item{Other variables}{ +#' In addition to the above, there is a two-letter code for each taxon (`spcode`) and the name of the island on which the taxon is found (`island`). +#' } #' } #' #' @name bimac #' @rdname bimac #' @docType data #' @family examples -#' @format A data frame with 45 observations on the following 8 variables. +#' @format A data frame with 45 observations on the following 11 variables. #' \describe{ #' \item{node}{Labels for the nodes.} +#' \item{spcode}{Two-letter code for each taxon.} #' \item{species}{Species names for extant species.} +#' \item{island}{Name of the island on which the population is found.} #' \item{size}{Body size (head length in mm) of extant species.} #' \item{ancestor}{Ancestral node.} #' \item{time}{Time of node.} diff --git a/R/plot.R b/R/plot.R index ed1bfa1..6f3c71a 100644 --- a/R/plot.R +++ b/R/plot.R @@ -17,7 +17,7 @@ #' There must be at least as many colors as levels in the `regimes`. #' @param labels character; taxon labels. #' @param margin numeric; width of the right margin (as a fraction of the plot width). -#' Adjust this if labels are clipped. +#' Adjust this if labels are clipped (see Examples below). #' @param text_opts options for the labels; passed to [`text`][graphics::text()]. #' @param legend_opts options for the the legend; passed to [`legend`][graphics::legend()]. #' @param ... additional arguments, passed to [`plot`][graphics::plot()]. @@ -47,7 +47,7 @@ tree.plot.internal <- function ( rx <- range(x@times,na.rm=T) margin <- as.numeric(margin) if (!(length(margin)==1 && isTRUE(margin>=0 && margin<1))) - pStop("plot",sQuote("margin")," should be between 0 and 1.") + pStop("plot",sQuote("margin")," should be one number between 0 and 1.") rxd <- margin*diff(rx)/(1-margin) anc <- x@anc.numbers root <- which(is.root.node(anc)) diff --git a/data/bimac.csv b/data/bimac.csv index 00da958..77a931a 100644 --- a/data/bimac.csv +++ b/data/bimac.csv @@ -1,46 +1,46 @@ -node;species;size;ancestor;time;OU.1;OU.3;OU.4;OU.LP -1;NA;NA;NA;0;ns;medium;anc;medium -2;NA;NA;1;12;ns;medium;anc;medium -3;NA;NA;2;32;ns;medium;anc;small -4;NA;NA;3;34;ns;medium;anc;small -5;NA;NA;4;36;ns;medium;anc;small -6;NA;NA;3;36;ns;medium;anc;small -7;NA;NA;1;8;ns;medium;anc;medium -8;NA;NA;7;13;ns;medium;anc;medium -9;NA;NA;8;18;ns;medium;anc;large -10;NA;NA;9;23;ns;medium;anc;large -11;NA;NA;10;28;ns;medium;anc;large -12;NA;NA;9;28;ns;medium;anc;large -13;NA;NA;8;22;ns;medium;anc;medium -14;NA;NA;13;26;ns;medium;anc;medium -15;NA;NA;14;34;ns;medium;anc;medium -16;NA;NA;15;36;ns;medium;anc;medium -17;NA;NA;7;28;ns;medium;anc;medium -18;NA;NA;17;30;ns;medium;anc;medium -19;NA;NA;18;34;ns;medium;anc;medium -20;NA;NA;19;36;ns;medium;anc;medium -21;NA;NA;20;37;ns;medium;anc;medium -22;NA;NA;19;36;ns;medium;anc;medium -23;po;13.5;2;38;ns;small;small;small -24;se;14.3;4;38;ns;small;small;small -25;sc;14.3;5;38;ns;small;small;small -26;sn;14.2;5;38;ns;small;small;small -27;wb;14.5;6;38;ns;small;small;small -28;wa;14.9;6;38;ns;small;small;small -29;be;23.6;10;38;ns;large;large;large -30;bn;27.1;11;38;ns;large;large;large -31;bc;27.9;11;38;ns;large;large;large -32;lb;28.6;12;38;ns;large;large;large -33;la;28.8;12;38;ns;large;large;large -34;nu;21.1;13;38;ns;medium;medium;medium -35;sa;18.3;14;38;ns;medium;medium;medium -36;gb;19.7;15;38;ns;medium;medium;medium -37;ga;18.8;16;38;ns;medium;medium;medium -38;gm;19.6;16;38;ns;large;large;large -39;oc;22.3;17;38;ns;medium;medium;medium -40;fe;28.4;18;38;ns;medium;medium;medium -41;li;18.7;20;38;ns;medium;medium;medium -42;mg;18.9;21;38;ns;medium;medium;medium -43;md;19.9;21;38;ns;medium;medium;medium -44;t1;21.3;22;38;ns;medium;medium;medium -45;t2;21.5;22;38;ns;medium;medium;medium +node;spcode;species;island;size;ancestor;time;OU.1;OU.3;OU.4;OU.LP +1;NA;NA;NA;NA;NA;0;ns;medium;anc;medium +2;NA;NA;NA;NA;1;12;ns;medium;anc;medium +3;NA;NA;NA;NA;2;32;ns;medium;anc;small +4;NA;NA;NA;NA;3;34;ns;medium;anc;small +5;NA;NA;NA;NA;4;36;ns;medium;anc;small +6;NA;NA;NA;NA;3;36;ns;medium;anc;small +7;NA;NA;NA;NA;1;8;ns;medium;anc;medium +8;NA;NA;NA;NA;7;13;ns;medium;anc;medium +9;NA;NA;NA;NA;8;18;ns;medium;anc;large +10;NA;NA;NA;NA;9;23;ns;medium;anc;large +11;NA;NA;NA;NA;10;28;ns;medium;anc;large +12;NA;NA;NA;NA;9;28;ns;medium;anc;large +13;NA;NA;NA;NA;8;22;ns;medium;anc;medium +14;NA;NA;NA;NA;13;26;ns;medium;anc;medium +15;NA;NA;NA;NA;14;34;ns;medium;anc;medium +16;NA;NA;NA;NA;15;36;ns;medium;anc;medium +17;NA;NA;NA;NA;7;28;ns;medium;anc;medium +18;NA;NA;NA;NA;17;30;ns;medium;anc;medium +19;NA;NA;NA;NA;18;34;ns;medium;anc;medium +20;NA;NA;NA;NA;19;36;ns;medium;anc;medium +21;NA;NA;NA;NA;20;37;ns;medium;anc;medium +22;NA;NA;NA;NA;19;36;ns;medium;anc;medium +23;po;Anolis pogus;St. Maarten;13.5;2;38;ns;small;small;small +24;se;Anolis schwartzi;St. Eustasius;14.3;4;38;ns;small;small;small +25;sc;Anolis schwartzi;St. Christopher;14.3;5;38;ns;small;small;small +26;sn;Anolis schwartzi;Nevis;14.2;5;38;ns;small;small;small +27;wb;Anolis wattsii;Barbuda;14.5;6;38;ns;small;small;small +28;wa;Anolis wattsii;Antigua;14.9;6;38;ns;small;small;small +29;be;Anolis bimaculatus;St. Eustasius;23.6;10;38;ns;large;large;large +30;bn;Anolis bimaculatus;Nevis;27.1;11;38;ns;large;large;large +31;bc;Anolis bimaculatus;St. Christopher;27.9;11;38;ns;large;large;large +32;lb;Anolis leachi;Barbuda;28.6;12;38;ns;large;large;large +33;la;Anolis leachi;Antigua;28.8;12;38;ns;large;large;large +34;nu;Anolis nubilus;Redonda;21.1;13;38;ns;medium;medium;medium +35;sa;Anolis sabanus;Saba;18.3;14;38;ns;medium;medium;medium +36;gb;Anolis gingivinus;St. Barthelemy;19.7;15;38;ns;medium;medium;medium +37;ga;Anolis gingivinus;Antigua;18.8;16;38;ns;medium;medium;medium +38;gm;Anolis gingivinus;St. Maarten;19.6;16;38;ns;large;large;large +39;oc;Anolis oculatus;Dominica;22.3;17;38;ns;medium;medium;medium +40;fe;Anolis ferreus;Marie Galante;28.4;18;38;ns;medium;medium;medium +41;li;Anolis lividus;Montserrat;18.7;20;38;ns;medium;medium;medium +42;mg;Anolis marmoratus;Guadeloupe;18.9;21;38;ns;medium;medium;medium +43;md;Anolis marmoratus;Desirade;19.9;21;38;ns;medium;medium;medium +44;t1;Anolis terraealtae;Illes de Saintes-1;21.3;22;38;ns;medium;medium;medium +45;t2;Anolis terraealtae;Illes de Saintes-2;21.5;22;38;ns;medium;medium;medium diff --git a/examples/bimac.R b/examples/bimac.R index 38ba825..a108edb 100644 --- a/examples/bimac.R +++ b/examples/bimac.R @@ -1,5 +1,5 @@ ## Analysis of Anolis bimaculatus data -tree <- with(bimac,ouchtree(node,ancestor,time/max(time),species)) +tree <- with(bimac,ouchtree(node,ancestor,time/max(time),spcode)) plot(tree,node.names=TRUE) h1 <- brown(log(bimac['size']),tree) @@ -21,6 +21,7 @@ plot(h4) h5 <- hansen(log(bimac['size']),tree,bimac['OU.LP'],sqrt.alpha=1,sigma=1,reltol=1e-5) h5 <- update(h5,method='subplex',reltol=1e-11,parscale=c(0.1,0.1),hessian=TRUE) h5 +plot(h5) simdat <- simulate(h5,nsim=10) hsim <- update(h5,data=simdat[[1]]) diff --git a/examples/bimac1.R b/examples/bimac1.R index cf574f1..5c3090b 100644 --- a/examples/bimac1.R +++ b/examples/bimac1.R @@ -1,8 +1,20 @@ tree <- with( bimac, - ouchtree(nodes=node,ancestors=ancestor,times=time,labels=species) + ouchtree(nodes=node,ancestors=ancestor,times=time,labels=spcode) ) tree plot(tree) -plot(tree,node.names=TRUE) +plot(tree, node.names=TRUE) # display node names + +## When taxon names are long, they are cut off when the +## default settings are used. For example: +tree2 <- with( + bimac, + ouchtree(nodes=node,ancestors=ancestor,times=time, + labels=ifelse(is.na(species),NA,paste(species,island,sep=", ")) + ) +) +plot(tree2) # long species names are cut off +## This is fixed by increasing right margin and font size: +plot(tree2,margin=0.5) diff --git a/inst/NEWS b/inst/NEWS index 9a65777..bf85fab 100644 --- a/inst/NEWS +++ b/inst/NEWS @@ -1,5 +1,10 @@ _N_e_w_s _f_o_r _P_a_c_k_a_g_e '_o_u_c_h' +_C_h_a_n_g_e_s _i_n _o_u_c_h _v_e_r_s_i_o_n _2._1_6-_6: + + • There is now an example showing how to plot a tree with long + taxon names. + _C_h_a_n_g_e_s _i_n _o_u_c_h _v_e_r_s_i_o_n _2._1_6-_3: • Error messages and examples have been improved somewhat. diff --git a/inst/NEWS.Rd b/inst/NEWS.Rd index c5f7f50..421a7e7 100644 --- a/inst/NEWS.Rd +++ b/inst/NEWS.Rd @@ -1,5 +1,10 @@ \name{NEWS} \title{News for Package 'ouch'} +\section{Changes in ouch version 2.16-6}{ + \itemize{ + \item There is now an example showing how to plot a tree with long taxon names. + } +} \section{Changes in ouch version 2.16-3}{ \itemize{ \item Error messages and examples have been improved somewhat. diff --git a/man/anolis_ssd.Rd b/man/anolis_ssd.Rd index 5336cd3..ece0a2c 100644 --- a/man/anolis_ssd.Rd +++ b/man/anolis_ssd.Rd @@ -10,7 +10,7 @@ A data frame with 38 observations on the following 6 variables. \item \code{node}: Labels for the nodes. \item \code{species}: Names of extant species. \item \code{log.SSD}: Log sexual size dimorphism of extant species. -\item \code{ancestor}: Ancestor node. +\item \code{ancestor}: Name of ancestor node. \item \code{time}: Time of node. \item \code{OU.1}: a factor with one level, \code{ns}. \item \code{OU.7}: a factor with levels corresponding to ecomorph (\code{tg}, \code{tc}, \code{gb}, \code{cg}, \code{tw}, \code{tr}, \code{anc}). @@ -29,9 +29,9 @@ The data were used to demonstrate an evolutionary association between habitat ty Size dimorphism was calcuated as the log-ratio of male snout-to-vent length to female snout-to-vent length (males are larger). In this example, we tested three models of evolution: -Brownian motion, Ornstein-Uhlenbeck with one global optimum, and Ornstein-Uhlenbeck with 7 optima (one for each ecomorph type plus an additional one for an "unknown" type). +Brownian motion, Ornstein-Uhlenbeck with one global optimum, and Ornstein-Uhlenbeck with seven optima (one for each ecomorph type plus an additional one for an "unknown" type). -For the 7-optima model, we assigned each terminal branch to an optimum according to the ecomorph type of the extant species. +For the seven-optima model, we assigned each terminal branch to an optimum according to the ecomorph type of the extant species. Because we had no information to help guide hypotheses about internal branches, we assigned internal branches to the "unknown" selective regime. The phylogeny of these species is consistent with and adaptive radiation, with a burst of speciation events early in the evolutionary history of this clade (see phylogeny in Butler & King (2004) or example below). diff --git a/man/bimac.Rd b/man/bimac.Rd index f37daac..22e1d75 100644 --- a/man/bimac.Rd +++ b/man/bimac.Rd @@ -5,10 +5,12 @@ \alias{bimac} \title{Anolis bimaculatus lizard size data} \format{ -A data frame with 45 observations on the following 8 variables. +A data frame with 45 observations on the following 11 variables. \describe{ \item{node}{Labels for the nodes.} +\item{spcode}{Two-letter code for each taxon.} \item{species}{Species names for extant species.} +\item{island}{Name of the island on which the population is found.} \item{size}{Body size (head length in mm) of extant species.} \item{ancestor}{Ancestral node.} \item{time}{Time of node.} @@ -27,7 +29,7 @@ It is used to test a hypothesis of character displacement using an interspecific The data frame has the following columns: \code{species} which are species names, \code{size} which is the phenotypic data, -and the variables \code{ancestor} and \code{time} which specify the topology of the phylogeny and the location of the nodes in time, respectively. +and the variables \code{node}, \code{ancestor}, and \code{time} which specify the topology of the phylogeny and the location of the nodes in time, respectively. The columns \code{OU.1}, \code{OU.3}, \code{OU.4}, and \code{OU.LP} specify four hypothetical arrangements of selective regimes. Explanations of the data follow: \describe{ @@ -36,26 +38,29 @@ We use the phenotypic data and phylogeny of Losos (1990), which employed the hea In this group of lizards, head length correlates very strongly with snout-to-vent length and the cube root of mass, which are standard measures of body size. The data are head lengths in mm; note that we use the log of this value in analyses. } -\item{Tree topology}{ -The tree topology is encoded via two vectors: \code{ancestor} and \code{time}. -Each node of the' phylogenetic tree has a corresponding row in the data frame, numbered from 1 to 45. -The columns \code{ancestor} and \code{time} specify the phylogeny. -The \code{ancestor} variable specifies the topology: it is a list indicating the ancestor of each node. -The root node has ancestor 0. -The variable \code{time} specifies the temporal location of each node, with the root node being at time 0. +\item{Tree structure}{ +The phylogenetic tree is encoded via three variables: +\code{node}, \code{ancestor}, and \code{time}. +The \code{node} variable gives a name to each node. +The \code{ancestor} variable names the ancestor of each node. +The root node has no ancestor (i.e., \code{ancestor=NA}). +The variable \code{time} specifies the temporal location of each node, the root node being at time 0. } \item{Specifications of selective regimes.}{ (Columns \code{OU.1}, \code{OU.3}, \code{OU.4}, \code{OU.LP}). -These columns are factors, the levels of which correspond to the "paintings" of the respective adaptive regime hypotheses onto the phylogeny (see \code{\link[=paint]{paint()}}). +These columns are factors, the levels of which correspond to the \dQuote{paintings} of the respective adaptive regime hypotheses onto the phylogeny (see \code{\link[=paint]{paint()}}). Each selective regime is named (small, medium, large, etc.). Each column corresponds to a different painting of the selective regimes, and thus to a different hypothesis. In this example, there are 3 alternative models (see Butler & King 2004): \code{OU.4} is 4-regime model, \code{OU.3} is 3-regime model (all ancestors are medium), \code{OU.LP} is the linear parsimony model. } +\item{Other variables}{ +In addition to the above, there is a two-letter code for each taxon (\code{spcode}) and the name of the island on which the taxon is found (\code{island}). +} } } \examples{ ## Analysis of Anolis bimaculatus data -tree <- with(bimac,ouchtree(node,ancestor,time/max(time),species)) +tree <- with(bimac,ouchtree(node,ancestor,time/max(time),spcode)) plot(tree,node.names=TRUE) h1 <- brown(log(bimac['size']),tree) @@ -77,6 +82,7 @@ plot(h4) h5 <- hansen(log(bimac['size']),tree,bimac['OU.LP'],sqrt.alpha=1,sigma=1,reltol=1e-5) h5 <- update(h5,method='subplex',reltol=1e-11,parscale=c(0.1,0.1),hessian=TRUE) h5 +plot(h5) simdat <- simulate(h5,nsim=10) hsim <- update(h5,data=simdat[[1]]) diff --git a/man/brown.Rd b/man/brown.Rd index a3c0518..b481edc 100644 --- a/man/brown.Rd +++ b/man/brown.Rd @@ -25,7 +25,7 @@ Brownian-motion model to data. } \examples{ ## Analysis of Anolis bimaculatus data -tree <- with(bimac,ouchtree(node,ancestor,time/max(time),species)) +tree <- with(bimac,ouchtree(node,ancestor,time/max(time),spcode)) plot(tree,node.names=TRUE) h1 <- brown(log(bimac['size']),tree) @@ -47,6 +47,7 @@ plot(h4) h5 <- hansen(log(bimac['size']),tree,bimac['OU.LP'],sqrt.alpha=1,sigma=1,reltol=1e-5) h5 <- update(h5,method='subplex',reltol=1e-11,parscale=c(0.1,0.1),hessian=TRUE) h5 +plot(h5) simdat <- simulate(h5,nsim=10) hsim <- update(h5,data=simdat[[1]]) diff --git a/man/ouchtree.Rd b/man/ouchtree.Rd index 06e07fc..b2c2c9c 100644 --- a/man/ouchtree.Rd +++ b/man/ouchtree.Rd @@ -37,12 +37,24 @@ It also (optionally) holds names of taxa for display purposes. \examples{ tree <- with( bimac, - ouchtree(nodes=node,ancestors=ancestor,times=time,labels=species) + ouchtree(nodes=node,ancestors=ancestor,times=time,labels=spcode) ) tree plot(tree) -plot(tree,node.names=TRUE) +plot(tree, node.names=TRUE) # display node names + +## When taxon names are long, they are cut off when the +## default settings are used. For example: +tree2 <- with( + bimac, + ouchtree(nodes=node,ancestors=ancestor,times=time, + labels=ifelse(is.na(species),NA,paste(species,island,sep=", ")) + ) +) +plot(tree2) # long species names are cut off +## This is fixed by increasing right margin and font size: +plot(tree2,margin=0.5) } \seealso{ \code{\link[=ape2ouch]{ape2ouch()}} diff --git a/man/plot.Rd b/man/plot.Rd index 3a02c6f..451703d 100644 --- a/man/plot.Rd +++ b/man/plot.Rd @@ -48,7 +48,7 @@ One can also specify the \code{n} colors as a vector of color codes. There must be at least as many colors as levels in the \code{regimes}.} \item{margin}{numeric; width of the right margin (as a fraction of the plot width). -Adjust this if labels are clipped.} +Adjust this if labels are clipped (see Examples below).} \item{text_opts}{options for the labels; passed to \code{\link[graphics:text]{text}}.} diff --git a/tests/bapst.Rout.save b/tests/bapst.Rout.save index be5813a..4ac797c 100644 --- a/tests/bapst.Rout.save +++ b/tests/bapst.Rout.save @@ -23,6 +23,6 @@ Type 'q()' to quit R. > tr <- with(x,ouchtree(nodes=node,ancestors=ancestor,times=time,labels=species)) > toc <- Sys.time() > print(toc-tic) -Time difference of 0.003015041 secs +Time difference of 0.002750397 secs > plot(tr) > diff --git a/tests/boot.Rout.save b/tests/boot.Rout.save index 12655ac..35558ac 100644 --- a/tests/boot.Rout.save +++ b/tests/boot.Rout.save @@ -52,7 +52,7 @@ btstrp> b5 <- sapply(simdat,function(x)summary(update(h5,data=x))$aic.c) btstrp> toc <- Sys.time() btstrp> print(toc-tic) -Time difference of 2.480107 secs +Time difference of 2.477404 secs btstrp> cat("approximate 95% AIC.c cutoff",signif(quantile(b1-b5,0.95),digits=3),"\n") approximate 95% AIC.c cutoff 2.58 diff --git a/tests/exacttree.Rout.save b/tests/exacttree.Rout.save index 95692b1..f8361d4 100644 --- a/tests/exacttree.Rout.save +++ b/tests/exacttree.Rout.save @@ -122,7 +122,14 @@ sigma squared: [2,] 0.25 1.25 theta: -NULL +$data1 + a b + 0.1305478 -1.0640968 + +$data2 + a b +-0.1571595 1.0860827 + loglik deviance aic aic.c sic dof -2.433922 4.867845 24.867845 -48.465489 25.662260 10.000000 > show(htree) @@ -150,7 +157,14 @@ sigma squared: [2,] 0.25 1.25 theta: -NULL +$data1 + a b + 0.1305478 -1.0640968 + +$data2 + a b +-0.1571595 1.0860827 + loglik deviance aic aic.c sic dof -2.433922 4.867845 24.867845 -48.465489 25.662260 10.000000 > @@ -190,7 +204,18 @@ sigma squared: [3,] -0.125 0.525 1.3125 theta: -NULL +$data3 + a b +-2.415739 -1.281838 + +$data4 + a b +-0.9444604 0.6716862 + +$data5 + a b + 1.597923 -1.084672 + loglik deviance aic aic.c sic dof -41.42685 82.85369 118.85369 21.13941 127.58201 18.00000 > diff --git a/tests/plot.R b/tests/plot.R index 8653eae..352f4cc 100644 --- a/tests/plot.R +++ b/tests/plot.R @@ -3,27 +3,26 @@ set.seed(1106216184L) png(filename="plot%02d.png") -tree <- with(bimac,ouchtree(node,ancestor,time/max(time),species)) +tree <- with(bimac,ouchtree(node,ancestor,time/max(time),spcode)) plot(tree,node.names=TRUE) plot(tree,regimes=bimac["OU.3"],node.names=TRUE,ladderize=TRUE) plot(tree,regimes=bimac["OU.3"],node.names=FALSE,ladderize=FALSE) bimac <- bimac[order(runif(n=nrow(bimac))),] -tree <- with(bimac,ouchtree(node,ancestor,time,species)) +tree <- with(bimac,ouchtree(node,ancestor,time,spcode)) plot(tree,regimes=bimac["OU.3"],node.names=FALSE,ladderize=TRUE) plot(tree,regimes=bimac["OU.3"],node.names=TRUE,ladderize=FALSE) -bimac$silly <- ifelse(is.na(bimac$species),NA_character_,"anamagrophilexidicenappendocitemiousness") -tree1 <- with(bimac,ouchtree(node,ancestor,time/max(time),silly)) +tree1 <- with(bimac,ouchtree(node,ancestor,time,species)) plot(tree1) plot(tree1,regimes=bimac["OU.LP"],margin=0.7) try(plot(tree,margin=c(0.01,0.8),palette=hcl.colors)) try(plot(tree,margin=2,palette=hcl.colors)) try(plot(tree,margin=-1,palette=hcl.colors)) -plot(tree,margin=0.2,palette=hcl.colors(1)) +plot(tree,margin=0.4,palette=hcl.colors(1)) try(plot(tree,margin=0.2,regimes=bimac["OU.3"],palette=hcl.colors(1))) -plot(tree,margin=0.2,regimes=bimac["OU.3"],palette=rainbow(5)) +plot(tree,margin=0.4,regimes=bimac["OU.3"],palette=rainbow(5)) try(plot(tree,regimes=1:3)) try(plot(tree,regimes=bimac$OU.LP)) diff --git a/tests/plot.Rout.save b/tests/plot.Rout.save index ec08a9c..c1e8235 100644 --- a/tests/plot.Rout.save +++ b/tests/plot.Rout.save @@ -22,31 +22,30 @@ Type 'q()' to quit R. > > png(filename="plot%02d.png") > -> tree <- with(bimac,ouchtree(node,ancestor,time/max(time),species)) +> tree <- with(bimac,ouchtree(node,ancestor,time/max(time),spcode)) > plot(tree,node.names=TRUE) > > plot(tree,regimes=bimac["OU.3"],node.names=TRUE,ladderize=TRUE) > plot(tree,regimes=bimac["OU.3"],node.names=FALSE,ladderize=FALSE) > > bimac <- bimac[order(runif(n=nrow(bimac))),] -> tree <- with(bimac,ouchtree(node,ancestor,time,species)) +> tree <- with(bimac,ouchtree(node,ancestor,time,spcode)) > plot(tree,regimes=bimac["OU.3"],node.names=FALSE,ladderize=TRUE) > plot(tree,regimes=bimac["OU.3"],node.names=TRUE,ladderize=FALSE) > -> bimac$silly <- ifelse(is.na(bimac$species),NA_character_,"anamagrophilexidicenappendocitemiousness") -> tree1 <- with(bimac,ouchtree(node,ancestor,time/max(time),silly)) +> tree1 <- with(bimac,ouchtree(node,ancestor,time,species)) > plot(tree1) > plot(tree1,regimes=bimac["OU.LP"],margin=0.7) > try(plot(tree,margin=c(0.01,0.8),palette=hcl.colors)) -Error : in 'plot': 'margin' should be between 0 and 1. +Error : in 'plot': 'margin' should be one number between 0 and 1. > try(plot(tree,margin=2,palette=hcl.colors)) -Error : in 'plot': 'margin' should be between 0 and 1. +Error : in 'plot': 'margin' should be one number between 0 and 1. > try(plot(tree,margin=-1,palette=hcl.colors)) -Error : in 'plot': 'margin' should be between 0 and 1. -> plot(tree,margin=0.2,palette=hcl.colors(1)) +Error : in 'plot': 'margin' should be one number between 0 and 1. +> plot(tree,margin=0.4,palette=hcl.colors(1)) > try(plot(tree,margin=0.2,regimes=bimac["OU.3"],palette=hcl.colors(1))) Error : in 'plot': 'palette' must be either a function or a character vector of length >= 3. -> plot(tree,margin=0.2,regimes=bimac["OU.3"],palette=rainbow(5)) +> plot(tree,margin=0.4,regimes=bimac["OU.3"],palette=rainbow(5)) > > try(plot(tree,regimes=1:3)) Error : in 'plot': there must be one entry in 'regimes' per node of the tree. diff --git a/tests/plot06.png b/tests/plot06.png index 9242813..0d92591 100644 Binary files a/tests/plot06.png and b/tests/plot06.png differ diff --git a/tests/plot07.png b/tests/plot07.png index 0f77362..abcbcb1 100644 Binary files a/tests/plot07.png and b/tests/plot07.png differ diff --git a/tests/plot08.png b/tests/plot08.png index c6745c1..fac32f9 100644 Binary files a/tests/plot08.png and b/tests/plot08.png differ diff --git a/tests/plot09.png b/tests/plot09.png index 760ab67..50ac69f 100644 Binary files a/tests/plot09.png and b/tests/plot09.png differ diff --git a/tests/simtree.Rout.save b/tests/simtree.Rout.save index 7d6bf00..542fbd1 100644 --- a/tests/simtree.Rout.save +++ b/tests/simtree.Rout.save @@ -92,7 +92,7 @@ Type 'q()' to quit R. > tree <- with(x,ouchtree(node,ancestor,time)) > toc <- Sys.time() > print(toc-tic) -Time difference of 1.393314 secs +Time difference of 1.262304 secs > > bfit <- brown(data=x[c("A","B")],tree) > print(summary(bfit)) @@ -135,7 +135,7 @@ $dof > hfit <- hansen(data=x[c("A","B")],tree=tree,regimes=x['reg'],sqrt.alpha=a,sigma=s,fit=F) > toc <- Sys.time() > print(toc-tic) -Time difference of 0.1388385 secs +Time difference of 0.131125 secs > print(summary(hfit)) $call hansen(data = x[c("A", "B")], tree = tree, regimes = x["reg"], @@ -157,12 +157,12 @@ $sigma.squared [1,] 0.01 0.00 [2,] 0.00 0.01 -$optimum -$optimum$A +$optima +$optima$A ns -0.06150747 -$optimum$B +$optima$B ns -0.0677411 @@ -203,7 +203,7 @@ $dof > tree <- with(x,ouchtree(node,ancestor,time)) > toc <- Sys.time() > print(toc-tic) -Time difference of 1.381932 secs +Time difference of 1.25045 secs > > bfit <- brown(data=x[c("A","B")],tree) > print(summary(bfit)) @@ -283,7 +283,7 @@ $dof > hfit <- hansen(data=x[c("A","B")],tree=tree,regimes=x['reg'],sqrt.alpha=a,sigma=s,fit=F) > toc <- Sys.time() > print(toc-tic) -Time difference of 0.1810303 secs +Time difference of 0.1719985 secs > print(summary(hfit)) $call hansen(data = x[c("A", "B")], tree = tree, regimes = x["reg"], @@ -305,12 +305,12 @@ $sigma.squared [1,] 0.01 0.00 [2,] 0.00 0.01 -$optimum -$optimum$A +$optima +$optima$A big small -2.718422 2.390460 -$optimum$B +$optima$B big small 0.1872681 2.3082618 diff --git a/tests/snizard.Rout.save b/tests/snizard.Rout.save index afaaf89..84c61a6 100644 --- a/tests/snizard.Rout.save +++ b/tests/snizard.Rout.save @@ -26,7 +26,7 @@ Loading required package: ape > tree.1 <- ape2ouch(tree) > toc <- Sys.time() > print(toc-tic) -Time difference of 0.1143496 secs +Time difference of 0.1059148 secs > tree.data <- merge( + as(tree.1,"data.frame"), + squam.data, @@ -53,7 +53,7 @@ Time difference of 0.1143496 secs > h4 <- hansen(data=tree.data['log.SVL.SE'],tree.2,tree.data['OU2'],sqrt.alpha=0.5,sigma=1,fit=F) > toc <- Sys.time() > print(toc-tic) -Time difference of 0.1595383 secs +Time difference of 0.1543462 secs > model.fits <- c(h1,h2,h3,h4) > names(model.fits) <- c("BM.1","BM.2","OU2.1","OU2.2") > sapply(model.fits,function(x)c(unlist(coef(x)),summary(x)$aic.c))