Description Usage Arguments Details Value Examples
View source: R/plot.discreteQ.R
Plots point estimates and uniform bands for quantile functions and quantile effect functions of possibly discrete outcomes.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
x |
an object produced by |
... |
other graphical parameters passed to |
which |
specifies the function for which the results are plotted. Possible values are (depending on the characteristics of the |
xlim |
the x limits (x1, x2) of the plot. By default, this corresponds to the range of quantiles specified by the argument q.range when calling |
ylim |
the y limits of the plot. |
main |
the title of the plot. If |
xlab |
a label for the x axis. |
ylab |
a label for the y axis. |
add |
logical; if TRUE only add to an existing plot. |
col.l |
color used for the line representing the point estimates. If |
col.b |
color used for the confidence bands. If |
shift |
scalar shifting the QF and the bands. Useful if add=TRUE and the functions overlap. |
lty.l |
line type. |
lwd.l |
line width. |
lty.b |
line types for the uniform bands. |
lwd.b |
line width for the confidence bands. |
support |
type of support restriction. If |
plot.discreteQ
will produce different types of plots depending on the
type of the discreteQ
object and on the value of the argument
which
. If the unconditional quantile function of the outcome (i.e. no
treatment was provided) has been estimated, then the only possibility
consists in plotting the estimated quantile function and its confidence
bands. If a treatment variable has been provided by
decomposition=FALSE
, then by default the quantile treatment effect
function is plotted but it is also possible to plot the quantile functions of
the control (which="Q0"
) and treated outcomes (which="Q1"
). If
decomposition=TRUE
, by default a matrix of 4 plots is produced: all
three quantile functions in the top-left panel, the observed difference in
the top-right panel, the composition effect in the bottom-right panel and the
unexplained component in the bottom-right panel. It is possible to plot any
of these components by setting the argument which
to one of the
following values: "Q0", "Q1", "Qc", "observed", "composition", "unexplained".
None.
None.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | set.seed(1234)
outcome <- rpois(100, 3)
results1 <- discreteQ(outcome)
plot(results1)
set.seed(1234)
treatment <- c(rep(0,100), rep(1,100))
reg <- rbinom(200, 1, 0.4+treatment*0.2)
outcome <- rpois(200, lambda = 2+4*reg)
results2 <- discreteQ(outcome, treatment, cbind(1, reg))
plot(results2)
plot(results2, which="Q0")
plot(results2, which="Q1", add=TRUE, shift=0.2, col.l="dark green", col.b="light green")
set.seed(1234)
group <- c(rep(0,100), rep(1,100))
reg <- rbinom(200, 1, 0.4+group*0.2)
outcome <- rpois(200, lambda = exp(-2+4*reg))
results3 <- discreteQ(outcome, group, cbind(1, reg), decomposition=TRUE)
plot(results3)
plot(results3, which="composition")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.