beta_mm: Obtain the shape parameters of a beta distribution

Description Usage Arguments Examples

View source: R/beta_mm.R

Description

Use the method of moments to obtain the shape1 (alpha) and shape2 (beta) parameters when provided either a vector of beta random variables or the sample mean and variance of such a vector.

Usage

1
beta_mm(mn = NULL, vr = NULL, p = NULL, na.rm = FALSE)

Arguments

mn

numeric vector of length == 1. The mean of a beta random variable. Must be specified if vr is not NULL

vr

numeric vector of length == 1. The variance of a beta random variable. Must be specified if mn is not NULL

p

numeric vector of length > 1. iid beta random variables. Must be NULL if mn and vr are not NULL

na.rm

logical. Do you wish to remove NA elements before calculating mean and variance? Defaults to FALSE and only takes effect if p is not NULL.

Examples

1
2
beta_mm(p = rbeta(1e6, 6, 1))
beta_mm(mn = 0.5, vr = 0.04)

bstaton1/StatonMisc documentation built on May 18, 2020, 12:06 a.m.