mixt {bmixture}R Documentation

Mixture of t-distribution

Description

Random generation and density function for a finite mixture of univariate t-distribution.

Usage

 
rmixt( n = 10, weight = 1, df = 1, mean = 0, sd = 1 ) 

dmixt( x, weight = 1, df = 1, mean = 0, sd = 1 ) 

Arguments

n

number of observations.

x

vector of quantiles.

weight

vector of probability weights, with length equal to number of components (k). This is assumed to sum to 1; if not, it is normalized.

df

vector of degrees of freedom (> 0, maybe non-integer). df = Inf is allowed.

mean

vector of means.

sd

vector of standard deviations.

Details

Sampling from finite mixture of t-distribution, with density:

Pr(x|\underline{w}, \underline{df}, \underline{μ}, \underline{σ}) = ∑_{i=1}^{k} w_{i} t_{df}(x| μ_{i}, σ_{i}),

where

t_{df}(x| μ, σ) = \frac{ Γ( \frac{df+1}{2} ) }{ Γ( \frac{df}{2} ) √{π df} σ } ≤ft( 1 + \frac{1}{df} ≤ft( \frac{x-μ}{σ} \right) ^2 \right) ^{- \frac{df+1}{2} }.

Value

Generated data as an vector with size n.

Author(s)

Reza Mohammadi a.mohammadi@uva.nl

References

Mohammadi, A., Salehi-Rad, M. R., and Wit, E. C. (2013) Using mixture of Gamma distributions for Bayesian analysis in an M/G/1 queue with optional second service. Computational Statistics, 28(2):683-700, doi: 10.1007/s00180-012-0323-3

Mohammadi, A., and Salehi-Rad, M. R. (2012) Bayesian inference and prediction in an M/G/1 with optional second service. Communications in Statistics-Simulation and Computation, 41(3):419-435, doi: 10.1080/03610918.2011.588358

See Also

rt, rmixnorm, rmixgamma

Examples

## Not run: 
n      = 10000   
weight = c( 0.3, 0.5, 0.2 )
df     = c( 4  , 4  , 4   )
mean   = c( 0  , 10 , 3   )
sd     = c( 1  , 1  , 1   )
    
data = rmixt( n = n, weight = weight, df = df, mean = mean, sd = sd )
  
hist( data, prob = TRUE, nclass = 30, col = "gray" )
  
x           = seq( -20, 20, 0.05 )
densmixt = dmixt( x, weight, df, mean, sd )
      
lines( x, densmixt, lwd = 2 )

## End(Not run)

[Package bmixture version 1.7 Index]