Last data update: 2014.03.03

R: Mixture of two gamma distributions and related equilibrium...
F_gam_mixR 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, k_1

shape2

shape parameter for second mixture component, k_2

scale_ratio

ratio of first scale component to second scale component, θ_1 / θ_2

mix

mixing proportion of first component, p

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; k_1, θ_1) + (1 - p) Γ(x; k_2, θ_2),

where Γ(x; k, θ) is the cumulative distribution function of a Gamma random variable with shape k and scale θ, 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 distribuion 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))

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(ARPobservation)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/ARPobservation/F_gam_mix.Rd_%03d_medium.png", width=480, height=480)
> ### Name: F_gam_mix
> ### Title: Mixture of two gamma distributions and related equilibrium
> ###   distribution
> ### Aliases: F_gam_mix
> 
> ### ** 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))
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>