Title: | Truncated Scale Mixtures of Normal Distributions |
---|---|
Description: | Return the first four moments of the SMN distributions (Normal, Student-t, Pearson VII, Slash or Contaminated Normal). |
Authors: | Eraldo B. dos Anjos Filho <[email protected]> and Aldo William Medina Garay <[email protected]> |
Maintainer: | Eraldo B. dos Anjos Filho <[email protected]> |
License: | GPL (>= 3.0) |
Version: | 1.0.0 |
Built: | 2024-11-17 06:33:46 UTC |
Source: | CRAN |
This package includes two functions related to the truncated scale mixtures of normal distribution. One of then is to generate random samples from TSMN distribution, and other is to compute the first four theoretical moments.
Eraldo B. dos Anjos Filho [email protected] and Aldo M. Garay [email protected]
Maintainer: Eraldo B. dos Anjos Filho [email protected]
Aldo M. Garay, Victor H. Lachos, Heleno Bolfarine, Celso R. Cabral. "Linear censored regression models with scale mixtures of normal distributions". Statistical Papers, 2017, vol. 58, issue 1, pages 247-278
## A test sample to compare theoretical and empirical moments, considering the following parameters: mu = 2 sigma2 = 4 nu = 5 lower = -3 upper = 10 dist = "T" n = 10000 ## Theoretical moments with TSMNmoments theor<-TSMNmoments(mu=mu, sigma2=sigma2, nu=nu, lower=lower, upper=upper, dist=dist) ## Generate the sample with TSMNgenerator to compute the empirical moments empir<-TSMNgenerator(n=n, mu=mu, sigma2=sigma2, nu=nu, lower=lower, upper=upper, dist=dist) ## Compare the results data.frame("1st" = c("Theoretic" = theor$EY1, "Empirical" = mean(empir)), "2nd" = c("Theoretic" = theor$EY2, "Empirical" = mean(empir^2)), "3rd" = c("Theoretic" = theor$EY3, "Empirical" = mean(empir^3)), "4th" = c("Theoretic" = theor$EY4, "Empirical" = mean(empir^4)))
## A test sample to compare theoretical and empirical moments, considering the following parameters: mu = 2 sigma2 = 4 nu = 5 lower = -3 upper = 10 dist = "T" n = 10000 ## Theoretical moments with TSMNmoments theor<-TSMNmoments(mu=mu, sigma2=sigma2, nu=nu, lower=lower, upper=upper, dist=dist) ## Generate the sample with TSMNgenerator to compute the empirical moments empir<-TSMNgenerator(n=n, mu=mu, sigma2=sigma2, nu=nu, lower=lower, upper=upper, dist=dist) ## Compare the results data.frame("1st" = c("Theoretic" = theor$EY1, "Empirical" = mean(empir)), "2nd" = c("Theoretic" = theor$EY2, "Empirical" = mean(empir^2)), "3rd" = c("Theoretic" = theor$EY3, "Empirical" = mean(empir^3)), "4th" = c("Theoretic" = theor$EY4, "Empirical" = mean(empir^4)))
This function generate random TSMN samples from Normal, Student-t, Slash and Contaminated Normal, using the the inverse method.
TSMNgenerator(n, mu, sigma2, nu = NULL, lower = -Inf, upper = Inf, dist = "Normal")
TSMNgenerator(n, mu, sigma2, nu = NULL, lower = -Inf, upper = Inf, dist = "Normal")
n |
Number of observations. |
mu |
Location parameter. |
sigma2 |
Scale parameter. |
nu |
Parameter of the scale variable of the SMN family. Must be NULL in case of Normal distribution. Must be a bidimensional vector in case of contaminated normal distribution (CNormal). |
lower |
Lower bounds. |
upper |
Upper bounds. |
dist |
Distribution to be used: "Normal" for Normal model, "T" for Student-t model, "Slash" for slash model and "CNormal" for contaminated Normal model. |
For the contaminated Normal distribution, each component of the bidimensional vector "nu" must lie on (0,1).
Returns the sample generated according to the parameters.
Eraldo B. dos Anjos Filho [email protected] and Aldo M. Garay [email protected]
Maintainer: Eraldo B. dos Anjos Filho [email protected]
Aldo M. Garay, Victor H. Lachos, Heleno Bolfarine, Celso R. Cabral. "Linear censored regression models with scale mixtures of normal distributions". Statistical Papers, 2017, vol. 58, issue 1, pages 247-278
## A test sample to compare theoretical and empirical moments, considering the following parameters: mu = 2 sigma2 = 4 nu = 5 lower = -3 upper = 10 dist = "T" n = 10000 ## Theoretical moments with TSMNmoments theor<-TSMNmoments(mu=mu, sigma2=sigma2, nu=nu, lower=lower, upper=upper, dist=dist) ## Generate the sample with TSMNgenerator to compute the empirical moments empir<-TSMNgenerator(n=n, mu=mu, sigma2=sigma2, nu=nu, lower=lower, upper=upper, dist=dist) ## Compare the results data.frame("1st" = c("Theoretic" = theor$EY1, "Empirical" = mean(empir)), "2nd" = c("Theoretic" = theor$EY2, "Empirical" = mean(empir^2)), "3rd" = c("Theoretic" = theor$EY3, "Empirical" = mean(empir^3)), "4th" = c("Theoretic" = theor$EY4, "Empirical" = mean(empir^4)))
## A test sample to compare theoretical and empirical moments, considering the following parameters: mu = 2 sigma2 = 4 nu = 5 lower = -3 upper = 10 dist = "T" n = 10000 ## Theoretical moments with TSMNmoments theor<-TSMNmoments(mu=mu, sigma2=sigma2, nu=nu, lower=lower, upper=upper, dist=dist) ## Generate the sample with TSMNgenerator to compute the empirical moments empir<-TSMNgenerator(n=n, mu=mu, sigma2=sigma2, nu=nu, lower=lower, upper=upper, dist=dist) ## Compare the results data.frame("1st" = c("Theoretic" = theor$EY1, "Empirical" = mean(empir)), "2nd" = c("Theoretic" = theor$EY2, "Empirical" = mean(empir^2)), "3rd" = c("Theoretic" = theor$EY3, "Empirical" = mean(empir^3)), "4th" = c("Theoretic" = theor$EY4, "Empirical" = mean(empir^4)))
Return the first four moments of TSMN distributions, as example Normal, Student-t, Pearson VII, Slash or Contaminated Normal.
TSMNmoments(mu, sigma2, nu=NULL, delta=NULL, lower=-Inf, upper=Inf, dist="Normal")
TSMNmoments(mu, sigma2, nu=NULL, delta=NULL, lower=-Inf, upper=Inf, dist="Normal")
mu |
Location parameter. |
sigma2 |
Scale parameter. |
nu |
Parameter of the scale variable of the SMN family. Must be NULL in case of Normal distribution. Must be a bidimensional vector in case of contaminated normal distribution (CNormal). |
delta |
Second parameter of Pearson VII. Must not be provided in case of Normal, Student-t or Slash distribution. |
lower |
Lower bounds. |
upper |
Upper bounds. |
dist |
Distribution to be used: "Normal" for Normal model, "T" for Student-t model, "PearsonVII" for Pearson VII model, "Slash" for slash model and "CNormal" for contaminated Normal model. |
For the contaminated Normal distribution, each component of the bidimensional vector "nu" must lie on (0,1).
EY1 |
The first moment |
EY2 |
The second moment |
EY3 |
The third moment |
EY4 |
The fourth moment |
Eraldo B. dos Anjos Filho [email protected] and Aldo M. Garay [email protected]
Maintainer: Eraldo B. dos Anjos Filho [email protected]
Aldo M. Garay, Victor H. Lachos, Heleno Bolfarine, Celso R. Cabral. "Linear censored regression models with scale mixtures of normal distributions". Statistical Papers, 2017, vol. 58, issue 1, pages 247-278
## A test sample to compare theoretical and empirical moments, considering the following parameters: mu = 2 sigma2 = 4 nu = 5 lower = -3 upper = 10 dist = "T" n = 10000 ## Theoretical moments with TSMNmoments theor<-TSMNmoments(mu=mu, sigma2=sigma2, nu=nu, lower=lower, upper=upper, dist=dist) ## Generate the sample with TSMNgenerator to compute the empirical moments empir<-TSMNgenerator(n=n, mu=mu, sigma2=sigma2, nu=nu, lower=lower, upper=upper, dist=dist) ## Compare the results data.frame("1st" = c("Theoretic" = theor$EY1, "Empirical" = mean(empir)), "2nd" = c("Theoretic" = theor$EY2, "Empirical" = mean(empir^2)), "3rd" = c("Theoretic" = theor$EY3, "Empirical" = mean(empir^3)), "4th" = c("Theoretic" = theor$EY4, "Empirical" = mean(empir^4)))
## A test sample to compare theoretical and empirical moments, considering the following parameters: mu = 2 sigma2 = 4 nu = 5 lower = -3 upper = 10 dist = "T" n = 10000 ## Theoretical moments with TSMNmoments theor<-TSMNmoments(mu=mu, sigma2=sigma2, nu=nu, lower=lower, upper=upper, dist=dist) ## Generate the sample with TSMNgenerator to compute the empirical moments empir<-TSMNgenerator(n=n, mu=mu, sigma2=sigma2, nu=nu, lower=lower, upper=upper, dist=dist) ## Compare the results data.frame("1st" = c("Theoretic" = theor$EY1, "Empirical" = mean(empir)), "2nd" = c("Theoretic" = theor$EY2, "Empirical" = mean(empir^2)), "3rd" = c("Theoretic" = theor$EY3, "Empirical" = mean(empir^3)), "4th" = c("Theoretic" = theor$EY4, "Empirical" = mean(empir^4)))