spCdfplot {simPop} | R Documentation |
Plot weighted cumulative distribution functions
Description
Plot cumulative distribution functions, possibly broken down according to conditioning variables and taking into account sample weights.
Usage
spCdfplot(
inp,
x,
cond = NULL,
approx = c(FALSE, TRUE),
n = 10000,
bounds = TRUE,
...
)
panelSpCdfplot(x, y, approx, bounds = TRUE, ...)
prepanelSpCdfplot(x, y, ...)
getCdf(x, weights = NULL, cond = NULL, data, ..., name = "")
prepCdf(x, w, ..., name = "")
## S3 method for class 'data.frame'
prepCdf(x, w, ..., name = "")
## Default S3 method:
prepCdf(x, w, ..., name = "")
Arguments
inp |
an object of class |
x |
a character vector specifying the columns of data available in the sample and the population (specified in input object 'inp') to be plotted. |
cond |
an optional character vector (of length 1, if used) specifying the conditioning variable. |
approx |
logicals indicating whether approximations of the cumulative
distribution functions should be computed. The default is to use
|
n |
integers specifying the number of points at which the
approximations take place (see |
bounds |
a logical indicating whether vertical lines should be drawn at 0 and 1 (the bounds for cumulative distribution functions). |
... |
further arguments to be passed to
|
Details
Weights are directly extracted from the input object inp
and are
taken into account by adjusting the step height. To be precise, the
weighted step height for an observation is defined as its weight divided by
the sum of all weights\ ( w_{i} / \sum_{j = 1}^{n} w_{j} ).
Value
An object of class "trellis"
, as returned by
xyplot
.
Author(s)
Andreas Alfons
References
A. Alfons, M. Templ (2011) Simulation of close-to-reality population data for household surveys with application to EU-SILC. Statistical Methods & Applications, 20 (3), 383–407. doi: 10.1007/s10260-011-0163-2
See Also
Examples
## these take some time and are not run automatically
## copy & paste to the R command line
set.seed(1234) # for reproducibility
data(eusilcS) # load sample data
## Not run:
## approx. 20 seconds computation time
inp <- specifyInput(data=eusilcS, hhid="db030", hhsize="hsize",
strata="db040", weight="db090")
simPop <- simStructure(data=inp, method="direct",
basicHHvars=c("age", "rb090", "hsize", "pl030", "pb220a"))
# multinomial model with random draws
eusilcM <- simContinuous(simPop, additional="netIncome",
regModel = ~rb090+hsize+pl030+pb220a,
upper=200000, equidist=FALSE, nr_cpus=1)
class(eusilcM)
# plot results
spCdfplot(eusilcM, "netIncome", cond=NULL)
spCdfplot(eusilcM, "netIncome", cond="rb090", layout=c(1,2))
## End(Not run)