Learn R Programming

simPop (version 2.1.3)

spCdf: (Weighted empirical) cumulative distribution function

Description

Compute a (weighted empirical) cumulative distribution function for survey or population data. For survey data, sample weights are taken into account.

Usage

spCdf(x, weights = NULL, approx = FALSE, n = 10000)

Value

A list of class "spCdf" with the following components:

x

a numeric vector containing the \(x\)-coordinates.

y

a numeric vector containing the \(y\)-coordinates.

approx

a logical indicating whether the coordinates represent an approximation.

Arguments

x

a numeric vector.

weights

an optional numeric vector containing sample weights.

approx

a logical indicating whether an approximation of the cumulative distribution function should be computed.

n

a single integer value; if approx is TRUE, this specifies the number of points at which the approximation takes place (see approx).

Author

Andreas Alfons and Stefan Kraft

Details

Sample weights 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} ).\)

If requested, the approximation is performed using the function approx.

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. tools:::Rd_expr_doi("10.1007/s10260-011-0163-2")

See Also

spCdfplot, ecdf, approx

Examples

Run this code

data(eusilcS)
cdfS <- spCdf(eusilcS$netIncome, weights = eusilcS$rb050)
plot(cdfS, type="s")

Run the code above in your browser using DataLab