node_plot: node_plot

Description Usage Arguments Examples

View source: R/sfun_rpm_20_04_04.R

Description

plots end-node of object of class rpms

Usage

1
node_plot(object, node, data, variable = NA, ...)

Arguments

object

rpms object

node

integer label of the desired end-node.

data

data.frame that includes variables used in rp_equ, e_equ, and design information

variable

string name of variable in data to use as x-axis in plot

...

further arguments passed to plot function.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
{

# 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) 

# plot node 6 if it is an end-node of the tree
if(6 %in% end_nodes(r1))
  node_plot(object=r1, node=6, data=CE[s1,])

# plot node 6 if it is an end-node of the tree
if(8 %in% end_nodes(r1))
  node_plot(object=r1, node=8, data=CE[s1,])

}

rpms documentation built on June 26, 2021, 1:07 a.m.