rpms: rpms

Description Usage Arguments Value Examples

View source: R/main_20_06_30.R

Description

main function producing a regression tree using variables from rp_equ to partition the data and fit the model e_equ on each node. Currently only uses data with complete cases of continuous variables.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
rpms(
  rp_equ,
  data,
  weights = ~1,
  strata = ~1,
  clusters = ~1,
  e_equ = ~1,
  e_fn = "survLm",
  l_fn = NULL,
  bin_size = NULL,
  gridpts = 3,
  perm_reps = 1000L,
  pval = 0.05
)

Arguments

rp_equ

formula containing all variables for partitioning

data

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

weights

formula or vector of sample weights for each observation

strata

formula or vector of strata labels

clusters

formula or vector of cluster labels

e_equ

formula for modeling data in each node

e_fn

string name of function to use for modeling (only "survLm" is operational)

l_fn

loss function (ignored)

bin_size

integer specifying minimum number of observations in each node

gridpts

integer number of middle points to do in search; set to n for categorical variables when e_equ is used.

perm_reps

integer specifying the number of thousands of permutation replications to use to estimate p-value

pval

numeric p-value used to reject null hypothesis in permutation test

Value

object of class "rpms"

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
{
# 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)
rpms(IRAX~EDUCA+AGE+BLS_URBN, data=CE[s1,], weights=~FINLWT21, clusters=~CID)

                 
# model linear fit between retirement account value and amount of income
# conditioning on education and accounting for clusterd data for households 
# with reported retirment account values > 0

rpms(IRAX~EDUCA, e_equ=IRAX~FINCBTAX, data=CE[s1,], weights=~FINLWT21, clusters=~CID)    

}

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