distreg_cfa {bayesdistreg}R Documentation

Counterfactual bayesian distribution regression

Description

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

Usage

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

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


[Package bayesdistreg version 0.1.0 Index]