Description Usage Arguments Value Examples
View source: R/Regression_Functions.R
distreg.sas
takes input object from dr_asympar() for semi asymptotic bayesian
distribution. This involves taking random draws from the normal approximation of the
posterior at each threshold value.
1 | distreg.sas(ind, drabj, data, vcovfn = "vcov", iter = 100)
|
ind |
index of object in list |
drabj |
object from dr_asympar() |
data |
dataframe, first column is the outcome |
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
1 2 3 4 5 6 7 8 | 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)
drsas1 = lapply(1:5,distreg.sas,drabj=drabj,data=data,iter=100)
drsas2 = lapply(1:5,distreg.sas,drabj=drabj,data=data,vcovfn="vcovHC",iter=100)
par(mfrow=c(3,2));invisible(lapply(1:5,function(i)plot(density(drsas1[[i]],.1))));par(mfrow=c(1,1))
par(mfrow=c(3,2));invisible(lapply(1:5,function(i)plot(density(drsas2[[i]],.1))));par(mfrow=c(1,1))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.