weighted_Stats.RdSome 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 )A numeric vector. For weighted_table, a matrix with
two columns can be used as input for cross-tabulation.
Optional vector of sample weights
Vector referring to selected cases
Computation method (can be "unbiased" or "ML")), see
stats::cov.wt
Vector with probabilities
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)).
Logical indicating whether relative or absolute frequencies should be calculated.
Numeric value
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.