Some descriptive statistics for weighted data: variance, standard deviation, means, skewness, excess kurtosis, quantiles and frequency tables. Missing values are automatically removed from the data.

weighted_mean(x, w=rep(1, length(x)), select=NULL  )

weighted_var(x, w=rep(1, length(x)), method="unbiased", select=NULL )

weighted_sd(x, w=rep(1, length(x)), method="unbiased", select=NULL )

weighted_skewness( x, w=rep(1,length(x)), select=NULL  )

weighted_kurtosis( x, w=rep(1,length(x)), select=NULL  )

weighted_quantile( x, w=rep(1,length(x)), probs=seq(0,1,.25), type=NULL, select=NULL )

weighted_table( x, w=NULL, props=FALSE )

Arguments

x

A numeric vector. For weighted_table, a matrix with two columns can be used as input for cross-tabulation.

w

Optional vector of sample weights

select

Vector referring to selected cases

method

Computation method (can be "unbiased" or "ML")), see stats::cov.wt

probs

Vector with probabilities

type

Quantile type. For unweighted data, quantile types 6 and 7 can be used (see stats::quantile). For weighted data, the quantile type "i/n" is used (see Hmisc::wtd.quantile)).

props

Logical indicating whether relative or absolute frequencies should be calculated.

Value

Numeric value

See also

See stats::weighted.mean for computing a weighted mean.

See stats::var for computing unweighted variances.

See stats::quantile and Hmisc::wtd.quantile) for quantiles.

Examples