Description Usage Arguments Value Examples
View source: R/sfun_rpm_20_04_04.R
Get index of elements in dataframe that are in the specified
end-node of an rpms
object. A "which" function for end-nodes.
1 |
x |
|
node |
integer label of the desired end-node. |
data |
dataframe containing the variables used for the recursive partitioning. |
vector of indexes for observations in the end-node.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | {
# 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 summary statistics of CUTENURE for households in end-nodes 7 and 8 of the tree
if(7 %in% end_nodes(r1))
summary(CE$CUTENURE[in_node(node=7, r1, data=CE[s1,])])
if(8 %in% end_nodes(r1))
summary(CE$CUTENURE[in_node(node=8, r1, data=CE[s1,])])
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.