weighted_stats: Key Statistics (Weighted)

Description Usage Arguments Details Value See Also Examples

View source: R/basic_stats.R

Description

weighted_stats returns the expectation/mean, population variance and standard deviations from a weighted vector (differing probabilities/distribution).

Usage

1

Arguments

x

vector of values, e.g. c(2,3,4)

p

vector of probabilities/frequencies, e.g. c(1,1,2) or c(0.25,0.25,0.5)

Details

probabilities accepts values for both frequency as well as probabilities.

Value

See Also

key_stats for calculating x with a uniform distribution.

Examples

1
2
weighted_stats(c(2,3,4), c(1,1,2))
weighted_stats(c(2,3,4), c(0.25,0.25,0.5))

shunyao643/ab1202ay2021 documentation built on Feb. 26, 2021, 8:53 a.m.