Learn R Programming

treelet (version 1.1)

Run_JTree: Treelet basis/hierarchical tree construction

Description

Returns information on the simultaneous construction of the treelet orthonormal basis and hierarchical tree, including which nodes were merged at each step and the basis at each specified step of the construction.

Usage

Run_JTree(X, maxlev, whichsave)

Arguments

X
the covariance matrix of the data. For example, if using this function on genetics data to improve estimates of heritability, as in the Crossett et al arXiv paper, this argument will be the estimated additive genetic relationship matrix $\hat{A}$.
maxlev
the maximum height of the tree. This must be an integer between 1 and nrow(X)-1.
whichsave
a vector containing the levels of the tree, specified as integers between 1 and maxlev, for which you want to save the basis functions and the covariance matrix.

Value

  • a list with components
  • basisThis is a list with maxlev elements. Only those elements that are specified in the whichsave argument will be non-null entries in the list. For the non-null entries, this is the orthonormal treelet basis calculated at that level of the tree.
  • ZposA matrix of dimension maxlev x 2. Each row records which two nodes/clusters of the tree were combined at each step in its construction.
  • TThis is a list with maxlev elements, where each element is a 2x2 Jacobi rotation matrix for each step of the treelet algorithm.
  • PCidxA matrix of dimension maxlev x 2, where each row is a permutation of $(1,2)$ indicating which of the two nodes/clusters merged at that step is the sum variable (value of 1) and which is the difference (value of 2).
  • all_nodesA matrix of dimension maxlev x nrow(X) giving node/cluster labels at each step of the treelet algorithm. A label of zero indicates a node/cluster that was merged with another node/cluster and was the difference variable.
  • TreeCovsThis is a list with maxlev elements. Only those elements that are specified in the whichsave argument will be non-null entries in the list. For the non-null entries, this is the covariance matrix calculated at that level of the tree. The covariances in this matrix are those between the weights (orthogonal projections onto local basis vectors) in the basis expansion of the data vector.

Details

This function serves as a wrapper for the functions Build_JTree and JTree_Basis, which build the hierarchical tree and calculate the basis and covariance matrix at each level, respectively.

References

http://arxiv.org/abs/1208.2253{arXiv:1208.2253v1 [stat.AP]}

Lee, AB, Nadler, B, Wasserman, L (2008). Treelets - an adaptive multi-scale basis for sparse unordered data. The Annals of Applied Statistics 2: 435-471. http://www.stat.cmu.edu/~annlee/AOAS137.pdf

See Also

Build_JTree, JTree_Basis, TCS

Examples

Run this code
data(Ahat)
out=Run_JTree(Ahat,49,49)
#The information in out$Zpos[1,] and out$all_nodes[1,]
#both show which two individuals were the first merged 
#in the tree.  The remaining rows give information
#on subsequent merges in the tree.

basis=out$basis[[49]]
cov=out$TreeCovs[[49]]
temp=basis#This is how you can use the basis and cov output
#to reconstruct the estimated relationship matrix.
#See how close temp and the original Ahat are:
Ahat1=round(Ahat,14)
temp1=round(temp,14)
sum(Ahat1!=temp1)
#In this example, we do start seeing discrepancies in the 15th digit and beyond.

Run the code above in your browser using DataLab