violinplot {sparsereg} | R Documentation |
Function for plotting posterior distribution of effects of interest.
Description
The function produces a violin plot for specified effects. This can be useful for presenting or examining particular marginal effects of interest.
Usage
violinplot(x, columns=NULL, newlabels=NULL, type="mode", stage=NULL)
Arguments
x |
Object of class sparsereg. |
columns |
A vector of numbers (or strings) corresponding to columns (or column names) to produce plots for. |
newlabels |
New labels for columns rather than variable names in object. If empty, variable names are used. |
type |
Options are "mode" and "mean". Whether to plot the posterior mode or mean. |
stage |
Currently, this argument is ignored. |
Details
Generates a violin plot for coefficients from object from class sparsereg. The desired coefficients can be requested using the columns argument and they can be assigned new names through newlabels.
References
Ratkovic, Marc and Tingley, Dustin. 2015. "Sparse Estimation with Uncertainty: Subgroup Analysis in Large Dimensional Design." Working paper.
See Also
sparsereg, plot.sparsereg, summary.sparsereg, difference, print.sparsereg
Examples
## Not run:
set.seed(1)
n<-500
k<-100
Sigma<-diag(k)
Sigma[Sigma==0]<-.5
X<-mvrnorm(n,mu=rep(0,k),Sigma=Sigma)
y.true<-3+X[,2]*2+X[,3]*(-3)
y<-y.true+rnorm(n)
##Fit a linear model with five covariates.
s1<-sparsereg(y,X[,1:5])
violinplot(s1,1:3)
## End(Not run)