smsn.mix: Fit univariate FM-SMSN distribution

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/mixsmsn.R

Description

Return EM algorithm output for FM-SMSN distributions (univaritate case, p=1).

Usage

1
2
3
4
5
6
smsn.mix(y, 
         nu, mu = NULL, sigma2 = NULL, shape = NULL, pii = NULL,
         g = NULL, get.init = TRUE,
         criteria = TRUE, group = FALSE, family = "Skew.normal",
         error = 0.00001, iter.max = 100, calc.im = TRUE, obs.prob = FALSE,
         kmeans.param = NULL)

Arguments

y

the response vector

nu

the parameter of the scale variable (vector or scalar) of the SMSN family (kurtosis parameter). It is necessary to all distributions. For the "Skew.cn" must be a vector of length 2 and values in (0,1)

mu

the vector of initial values (dimension g) for the location parameters

sigma2

the vector of initial values (dimension g) for the scale parameters

shape

the vector of initial values (dimension g) for the skewness parameters

pii

the vector of initial values (dimension g) for the weights for each cluster. Must sum one!

g

the number of cluster to be considered in fitting

get.init

if TRUE, the initial values are generated via k-means

criteria

if TRUE, AIC, DIC, EDC and ICL will be calculated

group

if TRUE, the vector with the classification of the response is returned

family

distribution family to be used in fitting ("Skew.t", "t", "Skew.cn", "Skew.slash", "slash", "Skew.normal", "Normal")

error

the covergence maximum error

iter.max

the maximum number of iterations of the EM algorithm. Default = 100

calc.im

if TRUE, the information matrix is calculated and the standard errors are reported

obs.prob

if TRUE, the posterior probability of each observation belonging to one of the g groups is reported

kmeans.param

a list with alternative parameters for the kmeans function when generating initial values, list(iter.max = 10, n.start = 1, algorithm = "Hartigan-Wong")

Value

Estimated values of the location, scale, skewness and kurtosis parameter.

Author(s)

Marcos Prates marcosop@est.ufmg.br, Victor Lachos hlachos@ime.unicamp.br and Celso Cabral celsoromulo@gmail.com

References

Rodrigo M. Basso, Victor H. Lachos, Celso R. B. Cabral, Pulak Ghosh (2010). "Robust mixture modeling based on scale mixtures of skew-normal distributions". Computational Statistics and Data Analysis, 54, 2926-2941. doi: 10.1016/j.csda.2009.09.031

Marcos Oliveira Prates, Celso Romulo Barbosa Cabral, Victor Hugo Lachos (2013)."mixsmsn: Fitting Finite Mixture of Scale Mixture of Skew-Normal Distributions". Journal of Statistical Software, 54(12), 1-20., URL https://doi.org/10.18637/jss.v054.i12.

See Also

mix.hist, im.smsn and smsn.search

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
mu1 <- 5; mu2 <- 20; mu3 <- 35
sigma2.1 <- 9; sigma2.2 <- 16; sigma2.3 <- 9
lambda1 <- 5; lambda2 <- -3; lambda3 <- -6
nu = 5

mu <- c(mu1,mu2,mu3)
sigma2 <- c(sigma2.1,sigma2.2,sigma2.3)
shape <- c(lambda1,lambda2,lambda3)
pii <- c(0.5,0.2,0.3)

arg1 = c(mu1, sigma2.1, lambda1, nu)
arg2 = c(mu2, sigma2.2, lambda2, nu)
arg3 = c(mu3, sigma2.3, lambda3, nu)
y <- rmix(n=1000, p=pii, family="Skew.t", arg=list(arg1,arg2,arg3))

## Not run: 
par(mfrow=c(1,2))
## Normal fit
Norm.analysis <- smsn.mix(y, nu = 3, g = 3, get.init = TRUE, criteria = TRUE, 
                          group = TRUE, family = "Normal", calc.im=FALSE)
mix.hist(y,Norm.analysis)
mix.print(Norm.analysis)
mix.dens(y,Norm.analysis)

## Skew Normal fit
Snorm.analysis <- smsn.mix(y, nu = 3, g = 3, get.init = TRUE, criteria = TRUE, 
                           group = TRUE, family = "Skew.normal", calc.im=FALSE)
mix.hist(y,Snorm.analysis)
mix.print(Snorm.analysis)
mix.dens(y,Snorm.analysis)

## t fit
t.analysis <- smsn.mix(y, nu = 3, g = 3, get.init = TRUE, criteria = TRUE, 
                        group = TRUE, family = "t", calc.im=FALSE)
mix.hist(y,t.analysis)
mix.print(t.analysis)
mix.dens(y,t.analysis)

## Skew t fit
St.analysis <- smsn.mix(y, nu = 3, g = 3, get.init = TRUE, criteria = TRUE, 
                        group = TRUE, family = "Skew.t", calc.im=FALSE)
mix.hist(y,St.analysis)
mix.print(St.analysis)
mix.dens(y,St.analysis)

## Skew Contaminated Normal fit
Scn.analysis <- smsn.mix(y, nu = c(0.3,0.3), g = 3, get.init = TRUE, criteria = TRUE, 
                         group = TRUE, family = "Skew.cn", calc.im=FALSE)
mix.hist(y,Scn.analysis)
mix.print(Scn.analysis)
mix.dens(y,Scn.analysis)

par(mfrow=c(1,1))
mix.dens(y,Norm.analysis)
mix.lines(y,Snorm.analysis,col="green")
mix.lines(y,t.analysis,col="red")
mix.lines(y,St.analysis,col="blue")
mix.lines(y,Scn.analysis,col="grey")

## End(Not run)

Example output

Loading required package: mvtnorm

 Number of observations:  1000 

       group 1 group 2 group 3
mu       6.986  15.214  32.445
sigma2   2.205  18.775   3.940

 AIC:  6370.771 

 BIC:  6410.033 

 EDC:  6405.367 

 ICL:  6522.789 

 EM iterations:  32 


 Number of observations:  1000 

       group 1 group 2 group 3
mu      15.827   5.165  35.012
sigma2   8.365  10.411  12.206
shape    0.676   3.364  -5.595

 AIC:  6301.147 

 BIC:  6355.132 

 EDC:  6348.717 

 ICL:  6405.916 

 EM iterations:  80 


 Number of observations:  1000 


 Hyperparameter(nu):  100 

       group 1 group 2 group 3
mu      15.334   7.000  32.454
sigma2  17.790   2.233   3.892

 AIC:  6373.771 

 BIC:  6417.941 

 EDC:  6412.692 

 ICL:  6526.912 

 EM iterations:  32 


 Number of observations:  1000 


 Hyperparameter(nu):  6.423804 

       group 1 group 2 group 3
mu       5.083  17.106  34.917
sigma2  10.148   4.599   9.242
shape    4.501   0.124  -4.797

 AIC:  6288.466 

 BIC:  6347.359 

 EDC:  6340.36 

 ICL:  6422.289 

 EM iterations:  100 


 Number of observations:  1000 


 Hyperparameter(nu):  0.09634313 0.1442448 

       group 1 group 2 group 3
mu      34.943   5.075  16.778
sigma2   9.334  10.017   5.005
shape   -5.004   4.562   0.225

 AIC:  6290.322 

 BIC:  6354.122 

 EDC:  6346.541 

 ICL:  6441.796 

 EM iterations:  101 

mixsmsn documentation built on Oct. 6, 2021, 5:10 p.m.

Related to smsn.mix in mixsmsn...