Description Usage Arguments Examples
View source: R/qtree_20_07_09.R
Code to write a latex qtree plot takes a rpm frame and returns latex code to produce qtree uses linearize as a guide Produces text code to produce tree structure in tex document Requires using LaTex packages and the following commands in preamble of LaTex doc: \usepackage{lscape} and \usepackage{tikz-qtree}
1 2 3 4 5 6 7 8 9 10 11 |
t1 |
rpms object created by rpms function |
title |
string for the top node of the tree |
label |
string used for labeling the tree figure |
caption |
string used for caption |
digits |
integer number of displayed digits |
s_size |
boolean indicating whether or not to include sample size |
scale |
numeric factor for scaling size of tree |
lscape |
boolean to display tree in landscape mode |
subnode |
starting node of subtree to plot |
1 2 3 4 5 6 7 8 9 10 11 12 | {
# model mean of retirement account value for households with reported
# retirment account values > 0 using a binary tree while accounting for
# clusterd data and sample weights.
s1<- which(CE$IRAX > 0)
r1 <-rpms(IRAX~EDUCA+AGE+BLS_URBN, data = CE[s1,], weights=~FINLWT21, clusters=~CID)
# get Latex code
qtree(r1)
}
|
sh: 1: cannot create /dev/null: Permission denied
\begin{figure}[htb]
\centering
\begin{tikzpicture}[scale=1, ]
\tikzset{every tree node/.style={align=center,anchor=north}}
\Tree [.{rpms} [.{$AGE \leq 47 $} [.{$AGE \leq 39 $} {\fbox{node 4} \\ \fbox{n = 1182} \\ \fbox{value 60616.29}} ][.{$AGE > 39 $} [.{$EDUCA \in \{2,3,4,5,6,7\}$} {\fbox{node 10} \\ \fbox{n = 563} \\ \fbox{value 117731.74}} ][.{$EDUCA \in \{8\}$} {\fbox{node 11} \\ \fbox{n = 167} \\ \fbox{value 301597.02}} ]]][.{$AGE > 47 $} [.{$EDUCA \in \{1,2,3,4,5,6\}$} {\fbox{node 6} \\ \fbox{n = 1411} \\ \fbox{value 201134.03}} ][.{$EDUCA \in \{7,8\}$} {\fbox{node 7} \\ \fbox{n = 1186} \\ \fbox{value 443781.94}} ]]]\end{tikzpicture}
\caption{\small }
\end{figure}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.