distreg_cfa.sas.Rd
distreg_cfa.sas
takes input object from dr_asympar
for counterfactual semi
asymptotic bayesian distribution. This involves taking random draws from the normal
approximation of the posterior at each threshold value.
distreg_cfa.sas(ind, drabj, data, cft, cfIND, vcovfn = "vcov", iter = 100)
ind | index of object in list |
---|---|
drabj | object from |
data | dataframe, first column is the outcome |
cft | column vector of counterfactual treatment |
cfIND | the column index(indices) of treatment variable(s) to replace with |
vcovfn | a string denoting the function to extract the variance-covariance. Defaults at "vcov". Other variance-covariance estimators in the sandwich package are usable. |
iter | number of draws to simulate |
fitob vector of random draws from density of F(yo) using semi-asymptotic BDR
y = faithful$waiting x = scale(cbind(faithful$eruptions,faithful$eruptions^2)) qtaus = quantile(y,c(0.05,0.25,0.5,0.75,0.95)) drabj<- dr_asympar(y=y,x=x,thresh = qtaus); data = data.frame(y,x) cfIND=2 #Note: the first column is the outcome variable. cft=0.95*data[,cfIND] # a decrease by 5% cfa.sasobj<- distreg_cfa.sas(ind=2,drabj,data,cft,cfIND,vcovfn="vcov") par(mfrow=c(1,2)); plot(density(cfa.sasobj$original,.1),main="Original") plot(density(cfa.sasobj$counterfactual,.1),main="Counterfactual"); par(mfrow=c(1,1))