F_gam_mix {ARPobservation}R Documentation

Mixture of two gamma distributions and related equilibrium distribution

Description

Random number generation from a mixture of two gamma distributions and the related equilibrium distribution, for use with r_behavior_stream.

Usage

F_gam_mix(shape1, shape2, scale_ratio, mix)

Arguments

shape1

shape parameter for first mixture component, k1k_1

shape2

shape parameter for second mixture component, k2k_2

scale_ratio

ratio of first scale component to second scale component, θ1/θ2\theta_1 / \theta_2

mix

mixing proportion of first component, pp

Value

Object of class eq_dist with components r_gen and r_eq.

The function r_gen(n, mean) generates random deviates from a mixture of two gamma distributions with specified mean, shape1, shape2, scale_ratio, and mix. The cumulative distribution function is given by

F(x)=pΓ(x;k1,θ1)+(1p)Γ(x;k2,θ2),F(x) = p \Gamma(x; k_1, \theta_1) + (1 - p) \Gamma(x; k_2, \theta_2),

where Γ(x;k,θ)\Gamma(x; k, \theta) is the cumulative distribution function of a Gamma random variable with shape kk and scale θ\theta, and the scale parameters are determined by the specified mean and scale_ratio.

The function r_eq(n, mean) generates random deviates from the equilibrium distribution corresponding to the mixture of gamma distributions.

Examples

hist(F_gam_mix(2, 2, 1 / 12, 3 / 5)$r_gen(1000, 20))
hist(F_gam_mix(2, 2, 1 / 12, 3 / 5)$r_eq(1000, 20))


[Package ARPobservation version 1.2.2 Index]