lsprobust.plot
plots estimated regression functions and confidence regions using the lspartition package.
See Cattaneo and Farrell (2013) and Cattaneo, Farrell and Feng (2020a) for complete details.
Companion command: lsprobust
for partitioning-based least squares regression
estimation and inference; lsprobust.plot
for plotting results; lsplincom
for multiple sample estimation and inference.
A detailed introduction to this command is given in Cattaneo, Farrell and Feng (2020b).
For more details, and related Stata and R packages useful for empirical analysis, visit https://sites.google.com/site/nppackages/.
lsprobust.plot(..., alpha = NULL, type = NULL, CS = "ci",
CStype = NULL, title = "", xlabel = "", ylabel = "", lty = NULL,
lwd = NULL, lcol = NULL, pty = NULL, pwd = NULL, pcol = NULL,
CSshade = NULL, CScol = NULL, legendTitle = NULL,
legendGroups = NULL)
A standard ggplot2
object is returned, hence can be used for further
customization.
Objects returned by lsprobust
.
Numeric scalar between 0 and 1, the significance level for plotting confidence regions. If more than one is provided, they will be applied to data series accordingly.
String, one of "line"
(default), "points"
, "binscatter"
,
"none"
or "both"
, how the point estimates are plotted. If more
than one is provided, they will be applied to data series accordingly.
String, type of confidence sets. Options are "ci"
for pointwise confidence
intervals, "cb"
for uniform confidence bands, and "all"
for both.
String, one of "region"
(shaded region, default), "line"
(dashed lines), "ebar"
(error bars), "all"
(all of the previous)
or "none"
(no confidence region), how the confidence region should
be plotted. If more than one is provided, they will be applied to data series accordingly.
If CS = "all"
, pointwise confidence intervals are forced to be represented by error bars,
and uniform bands are represented by both lines and regions.
String, title of the plot.
Strings, labels for x-axis.
Strings, labels for y-axis.
Line type for point estimates, only effective if type
is "line"
or
"both"
. 1
for solid line, 2
for dashed line, 3
for dotted line. For other options, see the instructions for ggplot2
or par
. If more than one is provided, they will be applied to data
series accordingly.
Line width for point estimates, only effective if type
is "line"
or "both"
. Should be strictly positive. For other options, see the
instructions for ggplot2
or par
. If more than one
is provided, they will be applied to data series accordingly.
Line color for point estimates, only effective if type
is "line"
or
"both"
. 1
for black, 2
for red, 3
for green,
4
for blue. For other options, see the instructions for ggplot2
or par
. If more than one is provided, they will be applied to
data series accordingly.
Scatter plot type for point estimates, only effective if type
is
"points"
or "both"
. For options, see the instructions for
ggplot2
or par
. If more than one is provided,
they will be applied to data series accordingly.
Scatter plot size for point estimates, only effective if type
is
"points"
or "both"
. Should be strictly positive. If more than
one is provided, they will be applied to data series accordingly.
Scatter plot color for point estimates, only effective if type
is
"points"
or "both"
. 1
for black, 2
for red,
3
for green, 4
for blue. For other options, see the instructions
for ggplot2
or par
. If more than one is provided,
they will be applied to data series accordingly.
Numeric, opaqueness of the confidence region, should be between 0 (transparent) and 1. Default is 0.2. If more than one is provided, they will be applied to data series accordingly.
Color for confidence region. 1
for black, 2
for red, 3
for green, 4
for blue. For other options, see the instructions for
ggplot2
or par
. If more than one is provided,
they will be applied to data series accordingly.
String, title of legend.
String vector, group names used in legend.
Matias D. Cattaneo, Princeton University, Princeton, NJ. cattaneo@princeton.edu.
Max H. Farrell, University of California, Santa Barbara, CA. maxhfarrell@ucsb.edu.
Yingjie Feng (maintainer), Tsinghua University, Beijing, China. fengyingjiepku@gmail.com.
Companion command: lsprobust
for partition-based least-squares regression
estimation.
Cattaneo, M. D., M. H. Farrell, and Y. Feng (2020a): Large Sample Properties of Partitioning-Based Series Estimators. Annals of Statistics, 48(3): 1718-1741, 2020.
Cattaneo, M. D., M. H. Farrell, and Y. Feng (2020b): lspartition: Partitioning-Based Least Squares Regression. R Journal, 12(1): 172-187, 2020.
lsprobust
, lspkselect
, lsplincom
, ggplot2
.
x <- runif(500)
y <- sin(4*x)+rnorm(500)
est <- lsprobust(y, x)
lsprobust.plot(est)
Run the code above in your browser using DataLab