gammaParams: Gamma Shape and Rate Determine the shape and rate parameter...

Description Usage Arguments Details Value Author(s) Examples

View source: R/stats.R

Description

Gamma Shape and Rate Determine the shape and rate parameter of a gamma distribution, given its central tendency and spread.See the 'Details' section for constraints on which arguments may be used together.

Usage

1

Arguments

mean

A numeric vector

mode

A numeric vector

sd

A numeric vector

Details

Only two parameters may be specified together. Specifically, one parameter relating to the distributions central tendency (i.e. mean or mode) must be specified with the standard deviation.

Value

Named list with 2 elements: S = Gamma shape parameter (alpha) R = Gamma rate parameter (beta)

Author(s)

Will Hopper (2016) Inspired by functions writen by John Krushke to accompany his "Doing Bayesian Data Analysis" book. Kruschke, J. K. (2015). Doing Bayesian Data Analysis, Second Edition: A Tutorial with R, JAGS, and Stan. Academic Press / Elsevier.

Examples

1
2
3
4
5
gammaParams(mean = 1.5, sd = 3)
gammaParams(mode = 2, sd = 3)

# Throws an error, because mean and mode cannot be used to find the shape and rate.
## Not run: gammaParams(mean = 2, mode = 3)

wjhopper/whoppeR documentation built on May 4, 2019, 7:33 a.m.