Learn R Programming

sparsereg (version 1.0)

plot.sparsereg: Plotting output from a sparse regression.

Description

Function for plotting coefficients from sparsereg analysis.

Usage

## S3 method for class 'sparsereg':
plot(x,...)

Arguments

x
Object from output of class sparsereg.
...
Additional items to pass to plot. Options below.

Details

The function returns up to three plots in one figure. Each plot corresponds with main effects, interaction effects, and two-way interactions. Additional options to pass below. main1, main2, main3{ Main titles for plots of main effects, interactive effects, and two-way interactions.} xlabel{ Label for x-axis. } plot.one{ Takes on the value of FALSE or 1, 2, or 3, denoting whether to return a single plot for main effects (1), interactive effects (2), or two-way interactions (3). }

stage{ When plotting output from a sparsereg object, the argument is ignored. When plotting output from a type 2 tobit, whether to return stage 1 or stage 2 results. }

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, volcanoplot, difference

Examples

Run this code
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])
 plot(s1)

Run the code above in your browser using DataLab