res_gamma: Estimates the parameters of a Gamma distribution from SDs

View source: R/helpers.R

res_gammaR Documentation

Estimates the parameters of a Gamma distribution from SDs

Description

This function calcualtes the parameters of a Gamma distribution from the residuals from an individuals' own mean. That is, the distribution of (standard) deviations from individuals' own mean are calculated and then an estimate of the parameters of a Gamma distribution are calculated.

Usage

res_gamma(x, ID)

Arguments

x

A data vector to operate on

ID

an ID variable of the same length as x

Value

a list of the shape (alpha) and rate (beta) parameters and the mean and variance

Author(s)

Joshua F. Wiley <jwiley.psych@gmail.com>

Examples


set.seed(1234)
y <- rgamma(100, 3, 2)
x <- rnorm(100 * 10, mean = 0, sd = rep(y, each = 10))
ID <- rep(1:100, each = 10)
res_gamma(x, ID)

ElkhartGroup/varian documentation built on March 20, 2023, 9:40 p.m.