BIFIE.ecdf {BIFIEsurvey}R Documentation

Empirical Distribution Function and Quantiles

Description

Computes an empirical distribution function (and quantiles). If only some quantiles should be calculated, then an appropriate vector of breaks (which are quantiles) must be specified. Statistical inference is not conducted for this method.

Usage

BIFIE.ecdf( BIFIEobj, vars, breaks=NULL, quanttype=1, group=NULL, group_values=NULL )

## S3 method for class 'BIFIE.ecdf'
summary(object,digits=4,...)

Arguments

BIFIEobj

Object of class BIFIEdata

vars

Vector of variables for which statistics should be computed.

breaks

Optional vector of breaks. Otherwise, it will be automatically defined.

quanttype

Type of calculation for quantiles. In case of quanttype=1, a linear interpolation is used (which is type='i/n' in Hmisc::wtd.quantile), while for quanttype=2 no interpolation is used.

group

Optional grouping variable

group_values

Optional vector of grouping values. This can be omitted and grouping values will be determined automatically.

object

Object of class BIFIE.ecdf

digits

Number of digits for rounding output

...

Further arguments to be passed

Value

A list with following entries

ecdf

Data frame with probabilities and the empirical distribution function (See Examples).

stat

Data frame with empirical distribution function stacked with respect to variables, groups and group values

output

More extensive output

...

More values

See Also

Hmisc::wtd.ecdf, Hmisc::wtd.quantile

Examples

#############################################################################
# EXAMPLE 1: Imputed TIMSS dataset
#############################################################################

data(data.timss1)
data(data.timssrep)

# create BIFIE.dat object
bifieobj <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt=data.timss1[[1]]$TOTWGT,
           wgtrep=data.timssrep[, -1 ] )

# ecdf
vars <- c( "ASMMAT", "books")
group <- "female" ; group_values <- 0:1
# quantile type 1
res1 <- BIFIEsurvey::BIFIE.ecdf( bifieobj,  vars=vars, group=group )
summary(res1)
res2 <- BIFIEsurvey::BIFIE.ecdf( bifieobj,  vars=vars, group=group, quanttype=2)
# plot distribution function
ecdf1 <- res1$ecdf
plot( ecdf1$ASMMAT_female0, ecdf1$yval, type="l")
plot( res2$ecdf$ASMMAT_female0, ecdf1$yval, type="l", lty=2)
plot( ecdf1$books_female0, ecdf1$yval, type="l", col="blue")

[Package BIFIEsurvey version 3.3-12 Index]