Learn R Programming

BIFIEsurvey (version 1.5-0)

BIFIE.ecdf: 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 while for quanttype=2 it is not.
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
  • ecdfData frame with probabilities and the empirical distribution function (See Examples).
  • outputMore extensive output
  • ...More values

See Also

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

Examples

Run this code
#############################################################################
# EXAMPLE 1: Imputed TIMSS dataset
#############################################################################

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

# create BIFIE.dat object
bifieobj <- 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 <- BIFIE.ecdf( bifieobj ,  vars = vars , group=group )
summary(res1)
res2 <- 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")

Run the code above in your browser using DataLab