distreg_cfa: Counterfactual bayesian distribution regression

Description Usage Arguments Value Examples

View source: R/Regression_Functions.R

Description

distreg draws randomly from the density of counterfactual of F(yo) at a threshold value yo

Usage

1
distreg_cfa(thresh, data0, MH = "IndepMH", cft, cfIND, ...)

Arguments

thresh

threshold value that is used to binarise the continuous outcome variable

data0

original data set with the first column being the continuous outcome variable

MH

metropolis-hastings algorithm to use; default:"IndepMH", alternative "RWMH"

cft

column vector of counterfactual treatment

cfIND

the column index(indices) of treatment variable(s) to replace with cft in data0

...

any additional inputs to pass to the MH algorithm

Value

robj a list of a vector of fitted values corresponding to random draws from F(yo), counterfactual F(yo), and the parameters

Examples

1
2
3
4
5
6
data0=faithful[,c(2,1)]; qnt<-quantile(data0[,1],0.25)
cfIND=2 #Note: the first column is the outcome variable. 
cft=0.95*data0[,cfIND] # a decrease by 5%
dist_cfa<- distreg_cfa(qnt,data0,cft,cfIND,MH="IndepMH",iter = 102, burn = 2)
par(mfrow=c(1,2)); plot(density(dist_cfa$counterfactual,.1),main="Original")
plot(density(dist_cfa$counterfactual,.1),main="Counterfactual"); par(mfrow=c(1,1))

bayesdistreg documentation built on May 1, 2019, 8:03 p.m.