Learn R Programming

ccfa (version 1.1.0)

getRes.CFA: getRes.CFA

Description

get a particular parameter of interest from a cfa object

Usage

getRes.CFA(cfaobj, fun, se = T, ...)

Arguments

cfaobj

a CFA object

fun

a function to apply for every value of the treatment in the cfaobj. The ccfa package provides several built-in functions: E (for expected value as a function of the treatment variable), Var (for the variance as a function of the treatment variable), IQR (the interquantile range as a function of the treatment variable), pov (the fraction of observations with outcomes below some threshold, as a function of the treatment variable), rich (the fraction of observations with outcomes above some threshold, as a function of the treatment variable), but other user-defined functions can be written. The requirement is that they need to take in an ecdf object and output a scalar result.

se

whether or not to compute standard errors

...

can pass additional arguments to fun using this argument

Value

CFASE object

Examples

Run this code
# NOT RUN {
data(igm)
tvals <- seq(10,12,length.out=8)
yvals <- seq(quantile(igm$lcfincome, .05), quantile(igm$lcfincome, .95),
  length.out=50)

## obtain counterfactual results
cfaresults <- cfa(lcfincome ~ lfincome, tvals=tvals, yvals=yvals, data=igm,
 se=FALSE)

## get the average outcome (lfincome) as a function of the treatment
## variable (lfincome)
getRes.CFA(cfaresults, E, se=FALSE)

## get the variance of the outcomes as a function of the treatment
## variable
getRes.CFA(cfaresults, Var, se=FALSE)

## get the inter-quantile range of outcomes as a function of the
## treatment variable
getRes.CFA(cfaresults, IQR, se=FALSE, t1=0.9, t2=0.1)

# }

Run the code above in your browser using DataLab