[Caic-commits] r87 - in pkg: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Apr 7 17:18:31 CEST 2009


Author: davidorme
Date: 2009-04-07 17:18:30 +0200 (Tue, 07 Apr 2009)
New Revision: 87

Modified:
   pkg/R/pglm.R
   pkg/man/brunch.Rd
Log:
Reinstated prune.single within lam.test.single until a better restructure permits a more integrated solution


Modified: pkg/R/pglm.R
===================================================================
--- pkg/R/pglm.R	2009-01-23 13:25:45 UTC (rev 86)
+++ pkg/R/pglm.R	2009-04-07 15:18:30 UTC (rev 87)
@@ -24,39 +24,7 @@
 ## #
 
 
-## prune.single has been made redundant by expanding the existing order.D and order.V and adding code to lik.lambda
 
-## prune.single <- function(x, data, V) {
-## 
-## 	dat <- data.frame(V1 = x, row.names=rownames(dat))
-## 
-## 	nms <- row.names(dat)
-## 	if(length(nms) == 0) stop("Need to supply row names for the data")
-## 	idx <- sort(nms, index.return = TRUE)$ix
-## 	sort.nms <- sort(nms, index.return = TRUE)$x
-## 	dat <- dat[idx,]
-## 	Vnms <- row.names(V)
-## 	if(length(Vnms) == 0) stop("Need to supply row names for the Variance matrix")
-## 	idx <- sort(Vnms, index.return = TRUE)$ix
-## 	V <- V[idx, idx]
-## 	
-## 	nms <- sort(nms)
-## 	Vn <- sort(row.names(V))
-## 	idx <- which(nms != Vn)
-## 	
-## 	
-## 	if(length(idx) > 0) stop("Error, taxon names do not match")
-## 	
-## 	complete <- complete.cases(dat)
-## 	idx <- which(complete == TRUE)
-## 	V <- V[idx, idx]
-## 	x <- dat[idx]
-## 	sort.prune.names <- sort.nms[idx]
-## 	dat <- data.frame(V1 = x, row.names = sort.prune.names)
-## 
-## 	return(list(dat = dat , V = V))
-## }
-
 lik.lambda <- function(x, V, data=NULL, lambda) {
 	
 	# rewritten CDLO 30/07/08
@@ -316,6 +284,39 @@
 
 lam.test.single <- function(x, data, V, pretty=TRUE) {
 
+    ## prune.single has been made redundant by expanding the existing order.D and order.V and adding code to lik.lambda
+    ## re-instated within lam.test.single until the code is better structured.
+    prune.single <- function(x, data, V) {
+
+    	dat <- data.frame(V1 = x, row.names=rownames(dat))
+
+    	nms <- row.names(dat)
+    	if(length(nms) == 0) stop("Need to supply row names for the data")
+    	idx <- sort(nms, index.return = TRUE)$ix
+    	sort.nms <- sort(nms, index.return = TRUE)$x
+    	dat <- dat[idx,]
+    	Vnms <- row.names(V)
+    	if(length(Vnms) == 0) stop("Need to supply row names for the Variance matrix")
+    	idx <- sort(Vnms, index.return = TRUE)$ix
+    	V <- V[idx, idx]
+	
+    	nms <- sort(nms)
+    	Vn <- sort(row.names(V))
+    	idx <- which(nms != Vn)
+	
+	
+    	if(length(idx) > 0) stop("Error, taxon names do not match")
+	
+    	complete <- complete.cases(dat)
+    	idx <- which(complete == TRUE)
+    	V <- V[idx, idx]
+    	x <- dat[idx]
+    	sort.prune.names <- sort.nms[idx]
+    	dat <- data.frame(V1 = x, row.names = sort.prune.names)
+
+    	return(list(dat = dat , V = V))
+    }
+
 	prune.dat <- prune.single(x, data, V)
 	
 	Vmat <- prune.dat$V

Modified: pkg/man/brunch.Rd
===================================================================
--- pkg/man/brunch.Rd	2009-01-23 13:25:45 UTC (rev 86)
+++ pkg/man/brunch.Rd	2009-04-07 15:18:30 UTC (rev 87)
@@ -1,7 +1,7 @@
 \name{brunch}
 \alias{brunch}
 %- Also NEED an '\alias' for EACH other topic documented here.
-\title{Comparative analysis using the crunch algorithm.}
+\title{Comparative analysis using the brunch algorithm.}
 \description{
 Calculate a linear model using the brunch algorithm.
 }
@@ -22,7 +22,7 @@
 }
 
 \details{
-This function implements the 'brunch' algorithm for modelling the relationship between variables that are phylogenetically non-independent. [The method was first described by Felsenstein (1985) and subsequently extended to permit the use of phylogenies with polytomies by Pagel (1992) - correct this...]. This method was previously implemented in the Mac Classic computer programs CAIC, written by Andy Purvis, Andy Rambaut (Purvis and Rambaut, 1995) and updated by Nick Isaac and Paul-Michael Agapow.
+This function implements the 'brunch' algorithm for modelling the relationship between variables that are phylogenetically non-independent. [The method was first described by Felsenstein (1985) and subsequently extended to permit the use of phylogenies with polytomies by Pagel (1992) - correct this...]. This method was previously implemented in the Mac Classic computer programs CAIC, written by Purvis and Rambaut (1995) and updated by Nick Isaac and Paul-Michael Agapow.
 
 The user provides a data frame and a phylogeny. These are matched using \code{names.col} to identify a column in the data frame that contains tip labels on the phylogeny. The formula specifies the model to be fitted and contrasts are calculated in those variables. The specified reference variable is used to ensure that contrasts for multivariate models are calculated in a consistent direction at each node. The function \code{caic} acts as a data preparation wrapper, finding the union between the phylogeny and data and reducing the dataset to the correct model and response matrices. The prepared data is then sent to the \code{contrCalc} engine, which is not intended to be called by users.
 



More information about the Caic-commits mailing list