Title: | Tests of Fit for some Probability Distributions |
---|---|
Description: | Goodness-of-fit tests for skew-normal, gamma, inverse Gaussian, log-normal, 'Weibull', 'Frechet', Gumbel, normal, multivariate normal, Cauchy, Laplace or double exponential, exponential and generalized Pareto distributions. Parameter estimators for gamma, inverse Gaussian and generalized Pareto distributions. |
Authors: | Elizabeth Gonzalez-Estrada, Jose A. Villasenor-Alva |
Maintainer: | Elizabeth Gonzalez-Estrada <[email protected]> |
License: | GPL (>= 3) |
Version: | 1.3.6 |
Built: | 2025-03-03 03:17:03 UTC |
Source: | https://github.com/cran/goft |
Two tests for the Cauchy distribution hypothesis.
cauchy_test(x, N = 10^3, method = "transf")
cauchy_test(x, N = 10^3, method = "transf")
x |
a numeric data vector containing a random sample of real numbers. |
N |
number of Monte Carlo samples used to approximate the p-value of the tests. Default is N = 10^3. |
method |
character string giving the name of the method to be used for testing the Cauchy distribution hypothesis. Two available options are |
Option "ratio"
performs a test for the Cauchy distribution based on the ratio of the maximum likelihood estimator for the scale parameter and the mean absolute deviation (Gonzalez-Estrada and Villasenor, 2018).
Option "transf"
performs a test based on a data transformation to approximately exponentially distributed data (Villasenor and Gonzalez-Estrada, 2020).
A list with class "htest"
containing the following components.
statistic |
the calculated value of the test statistic. |
p.value |
the approximated p-value of the test. |
method |
the character string "Test for the Cauchy distribution based on the ratio of two scale estimators". |
data.name |
a character string giving the name of the data set. |
Elizabeth Gonzalez-Estrada [email protected]
Gonzalez-Estrada, E. and Villasenor, J.A. (2018). An R package for testing goodness of fit: goft. Journal of Statistical Computation and Simulation, 88 4, 726-751. https://doi.org/10.1080/00949655.2017.1404604
Villasenor, J.A. and Gonzalez-Estrada, E. (2020). Goodness of fit tests for Cauchy distributions using data transformations. In I. Ghosh, N. Balakrishnan and H.K.T. Ng. Contributions of Barry C. Arnold to Statistical Science - Theory and Applications. Springer.
x <- rnorm(20) # simulating a data set from a normal distribution cauchy_test(x) # testing the Cauchy distribution hypothesis
x <- rnorm(20) # simulating a data set from a normal distribution cauchy_test(x) # testing the Cauchy distribution hypothesis
Correlation and ratio tests for Fisher-Tippet extreme value distributions.
ev_test(x, dist = "gumbel", method = "cor", N = 1000)
ev_test(x, dist = "gumbel", method = "cor", N = 1000)
x |
a numeric data vector containing a random sample. |
dist |
the extreme value distribution to be tested. Options are |
method |
the test to be used. Available options are |
N |
number of Monte Carlo samples used to approximate the p-value of the test when |
Option "ratio"
performs a test based on the ratio of two estimators for the variance of the Gumbel (type I extreme value) distribution (Gonzalez-Estrada and Villasenor, 2018).
Option "cor"
performs a test based on the max-stability property of extreme value distributions (Gonzalez-Estrada and Villasenor, 2010). The sample size must lie between 20 and 250.
A list with class "htest"
containing the following components.
statistic |
the calculated value of the test statistic. |
p.value |
the approximated p-value of the test. |
method |
a character string for the method used to test the null hypothesis. |
data.name |
a character string giving the name of the data set. |
Elizabeth Gonzalez-Estrada, Jose A. Villasenor
Gonzalez-Estrada, E. and Villasenor, J.A. (2018). An R package for testing goodness of fit: goft. Journal of Statistical Computation and Simulation, 88 4, 726-751. https://doi.org/10.1080/00949655.2017.1404604
Gonzalez-Estrada, E. and Villasenor-Alva, J.A. (2010). A Goodness-of-Fit Test for Location-Scale Max-Stable Distributions. Communications in Statistics: Simulation and Computation, 39 3, 557-562. https://doi.org/10.1080/03610910903528293
# Example 1: testing the Gumbel distribution hypothesis using the correlation test x <- -log(rexp(20)) # simulating a data set from the standard Gumbel distribution ev_test(x)
# Example 1: testing the Gumbel distribution hypothesis using the correlation test x <- -log(rexp(20)) # simulating a data set from the standard Gumbel distribution ev_test(x)
Test based on a data trasformation and Cox-Oakes test for exponentiality.
exp_test(x, method = "transf", N = 10^3)
exp_test(x, method = "transf", N = 10^3)
x |
a numeric data vector containing a random sample of positive real numbers. |
method |
test to be used. Tow available options are |
N |
number of Monte Carlo samples used to approximate p-values when |
Option "transf"
performs a test based on a transformation to approximately uniformly distributed variables.
If the sample size is larger than 200, the asymptotic null distribution of the test statistic is used to approximate the p-value; otherwise, it is approximated by Monte Carlo simulation (Villasenor and Gonzalez-Estrada, 2020).
Option "ratio"
performs Cox and Oakes (1984) test.
A list with class "htest"
containing the following components.
statistic |
the calculated value of the test statistic. |
p.value |
approximated p-value of the test. |
method |
a character string giving the name of the method used for testing exponentiality. |
data.name |
a character string giving the name of the data set. |
Elizabeth Gonzalez-Estrada, Jose A. Villasenor
Villasenor, J.A. and Gonzalez-Estrada, E. 2020. On testing exponentiality based on a new estimator for the scale parameter. Brazilian Journal of Probability and Statistics (accepted for publication).
Cox, D.R., Oakes, D. 1984. Analysis of Survival Data. Chapman and Hall/CRC.
# Testing exponentiality on a simulated random sample from the exponential distribution x <- rexp(20) exp_test(x)
# Testing exponentiality on a simulated random sample from the exponential distribution x <- rexp(20) exp_test(x)
Fits a Gamma distribution to a random sample of positive real numbers using Villasenor and Gonzalez-Estrada (2015) parameter estimators.
gamma_fit(x)
gamma_fit(x)
x |
a numeric data vector containing a random sample of positive real numbers. |
The Gamma distribution with shape and scale parameters is considered. The scale parameter is estimated by the unbiased sample estimator of the covariance of X and log(X). The shape parameter is estimated by the ratio of the sample mean of X and the scale parameter estimator.
Shape and scale parameter estimates.
Elizabeth Gonzalez-Estrada [email protected], Jose A. Villasenor-Alva
Villasenor, J.A. and Gonzalez-Estrada, E. (2015). A variance ratio test of fit for Gamma distributions. Statistics and Probability Letters, 96 1, 281-286. http://dx.doi.org/10.1016/j.spl.2014.10.001
gamma_test
for testing the Gamma distribution hypothesis.
# Fitting a gamma distribution to the logarithm of variable Loss contained in # the danishuni data set library(fitdistrplus) data(danishuni) logLoss <- log(danishuni$Loss) # logarithm of Loss variable logLoss <- logLoss[logLoss > 0] # observations > 0 gamma_fit(logLoss)
# Fitting a gamma distribution to the logarithm of variable Loss contained in # the danishuni data set library(fitdistrplus) data(danishuni) logLoss <- log(danishuni$Loss) # logarithm of Loss variable logLoss <- logLoss[logLoss > 0] # observations > 0 gamma_fit(logLoss)
Test of fit for the Gamma distribution with unknown shape and scale parameters based on the ratio of two variance estimators (Villasenor and Gonzalez-Estrada, 2015).
gamma_test(x)
gamma_test(x)
x |
a numeric data vector containing a random sample of positive real numbers. |
The test statistic is the ratio of two variance estimators, namely, the sample variance and the moments estimator obtained by Villasenor and Gonzalez-Estrada (2015), which is the product of the sample mean of X and the sample covariance of X and log(X).
The asymptotic null distribution of the test statistic is used to approximate p-values.
NOTE: the unbiased sample covariance estimator is used to compute the test statistic.
A list with class "htest"
containing the following components.
statistic |
the calculated value of the test statistic. |
p.value |
the approximated p-value of the test. |
method |
the character string "Test of fit for the Gamma distribution". |
data.name |
a character string giving the name of the data set. |
Elizabeth Gonzalez-Estrada [email protected], Jose A. Villasenor-Alva
Villasenor, J.A. and Gonzalez-Estrada, E. (2015). A variance ratio test of fit for Gamma distributions. Statistics and Probability Letters, 96 1, 281-286. http://dx.doi.org/10.1016/j.spl.2014.10.001
gamma_fit
for fitting a Gamma distribution to data.
# Testing the gamma distribution hypothesis on the logarithm of variable Loss # of the danishuni data set library(fitdistrplus) data(danishuni) logLoss <- log(danishuni$Loss) # logarithm of Loss variable logLoss <- logLoss[logLoss > 0] # observations > 0 gamma_test(logLoss)
# Testing the gamma distribution hypothesis on the logarithm of variable Loss # of the danishuni data set library(fitdistrplus) data(danishuni) logLoss <- log(danishuni$Loss) # logarithm of Loss variable logLoss <- logLoss[logLoss > 0] # observations > 0 gamma_test(logLoss)
Zoometric measurements of 27 week old creole goats collected by Dorantes-Coronado (2013).
data(goats)
data(goats)
A data frame with 52 rows and 7 columns containing measurements (in kilograms and centimeters) on the following variables.
body.weight
body.length
trunk.length
withers.height
thoracic.perimeter
hip.length
ear.length
Dorantes-Coronado (2013).
Dorantes-Coronado, E.J. (2013). Estudio preliminar para el establecimiento de un programa de mejoramiento genetico de cabras en el Estado de Mexico. Ph.D. Thesis. Colegio de Postgraduados, Mexico.
data(goats) plot(goats)
data(goats) plot(goats)
Fits a generalized Pareto distribution (gPd) to a random sample using either the asymptotic maximum likelihood method (amle) or the combined estimation method (Villasenor-Alva and Gonzalez-Estrada, 2009).
gp_fit(x, method)
gp_fit(x, method)
x |
a numeric data vector containing a random sample of positive real numbers. |
method |
a character string giving the name of the parameter estimation method to be used. There are two available methods: |
The distribution function of the gPd is provided in the details section of the gp_test function
.
Parameter estimates.
Elizabeth Gonzalez-Estrada, Jose A. Villasenor-Alva
Villasenor-Alva, J.A. and Gonzalez-Estrada, E. (2009). A bootstrap goodness of fit test for the generalized Pareto distribution. Computational Statistics and Data Analysis,53,11,3835-3841. http://dx.doi.org/10.1016/j.csda.2009.04.001
gp_test
for testing the gPd hypothesis.
# Example 1: fitting a gPd to the excesses above the threshold 0.165 ppm of the ozone # levels provided in the o3 data set. data(o3) o3levels <- o3$ozone_level - 0.165 # ozone levels minus the threshold 0.165 ppm gp_fit(o3levels, method = "combined") # fitting the gPd using the "combined" method # Example 2: fitting a gPd to a simulated data set from the uniform distribution, # which is a gPd with shape parameter = -1 and scale parameter = 1. x <- runif(100) # simulating a uniform random sample gp_fit(x, "combined") # fitting a gPd to x using the "combined" method
# Example 1: fitting a gPd to the excesses above the threshold 0.165 ppm of the ozone # levels provided in the o3 data set. data(o3) o3levels <- o3$ozone_level - 0.165 # ozone levels minus the threshold 0.165 ppm gp_fit(o3levels, method = "combined") # fitting the gPd using the "combined" method # Example 2: fitting a gPd to a simulated data set from the uniform distribution, # which is a gPd with shape parameter = -1 and scale parameter = 1. x <- runif(100) # simulating a uniform random sample gp_fit(x, "combined") # fitting a gPd to x using the "combined" method
Test of fit for the generalized Pareto distribution (gPd) with unknown parameters by Villasenor-Alva and Gonzalez-Estrada (2009).
gp_test(x, B = 999)
gp_test(x, B = 999)
x |
numeric data vector containing a random sample of positive real numbers. |
B |
number of bootstrap samples used to approximate p-values. Default is |
This bootstrap test for the null hypothesis a random sample has a gPd with unknown shape parameter
is an intersection-union test for the hypotheses
a random sample has a gPd with
, and
a random sample has a gPd with
.
Thus, heavy and non-heavy tailed gPd's are included in the null hypothesis. The parametric bootstrap is performed on
for each of the two hypotheses.
The gPd function with unknown shape and scale parameters and
is given by
where is a real number,
and
. When
, F(x) becomes the exponential distribution with scale parameter
:
A list with class "htest"
containing the following components.
p.value |
an approximated p-value of the test using parametric bootstrap. |
method |
the character string "Bootstrap test of fit for the generalized Pareto distribution". |
data.name |
a character string giving the name of the data set. |
pvalues |
approximated p-values of the tests for |
Elizabeth Gonzalez-Estrada [email protected], Jose A. Villasenor-Alva
Villasenor-Alva, J.A. and Gonzalez-Estrada, E. (2009). A bootstrap goodness of fit test for the generalized Pareto distribution. Computational Statistics and Data Analysis,53,11,3835-3841. http://dx.doi.org/10.1016/j.csda.2009.04.001
gp_fit
for fitting a gPd to data.
# Testing the gPd hypothesis on the excesses above the threshold 0.165 ppm of the ozone # levels given in the o3 data set data(o3) o3levels <- o3$ozone_level - 0.165 # ozone levels minus the threshold 0.165 ppm gp_test(o3levels) # testing the gPd hypothesis
# Testing the gPd hypothesis on the excesses above the threshold 0.165 ppm of the ozone # levels given in the o3 data set data(o3) o3levels <- o3$ozone_level - 0.165 # ozone levels minus the threshold 0.165 ppm gp_test(o3levels) # testing the gPd hypothesis
Maximum likelihood estimators for the Inverse Gaussian distribution based on a random sample.
ig_fit(x)
ig_fit(x)
x |
a numeric data vector containing a random sample of positive real numbers. |
Parameter estimates.
Elizabeth Gonzalez-Estrada [email protected], Jose A. Villasenor-Alva
ig_test
for testing the Inverse Gaussian distribution hypothesis.
x <- rgamma(50, 10) # simulating a random sample from the gamma distribution ig_fit(x) # fitting an inverse Gaussian distribution to x
x <- rgamma(50, 10) # simulating a random sample from the gamma distribution ig_fit(x) # fitting an inverse Gaussian distribution to x
Implementation of three tests of fit for Inverse Gaussian distributions with unknown parameters (see Details section).
ig_test(x, method = "transf")
ig_test(x, method = "transf")
x |
a numeric data vector containing a random sample of positive real numbers. |
method |
character string giving the name of the method to be used for testing the Inverse Gaussian hypothesis. Two available options are |
Option "transf"
performs two tests based on data transformations. One test
transforms the observations to approximately normally distributed observations and then uses Shapiro-Wilk test for asssessing univariate normality (Villasenor et al., 2019).
The other test is based on a transformation of data to gamma variables with shape parameter equal to 1/2 and uses Anderson-Darling test for testing the gamma distribution (Villasenor and Gonzalez-Estrada, 2015).
The right-hand side tail of the null distribution for Anderson-Darling test statistic is approximated by an inverse Gaussian distribution in order to get approximated p-values.
Option "ratio"
performs a test based on the ratio of two variance estimators. It is based on the asymptotic distribution of the test statistic. The use of this test is appropriate for large sample sizes (Villasenor and Gonzalez-Estrada, 2015).
A list with class "htest"
containing the following components.
statistic |
the calculated value of the test statistic. |
p.value |
the approximated p-value of the test. |
method |
a character string giving the name of the method used for testing the null hypothesis. |
data.name |
a character string giving the name of the data set. |
Elizabeth Gonzalez-Estrada [email protected], Jose A. Villasenor-Alva
Villasenor, J.A. and Gonzalez-Estrada, E. (2015). Tests of fit for Inverse Gaussian distributions. Statistics and Probability Letters, 105, 189-194. http://dx.doi.org/10.1016/j.spl.2015.06.017
Villasenor, J.A. Gonzalez-Estrada, E. and Ochoa, A. (2019). On Testing the Inverse Gaussian Distribution Hypothesis. Sankhya B: The Indian Journal of Statistics. 81, 60-74. https://doi.org/10.1007/s13571-017-0148-8
# Example 1: testing the inverse Gaussian distribution hypothesis using "transf" # option on the compressive strength variable of the strength data set. data("strength") y <- strength$cstrength # compressive strength ig_test(y, method = "transf") # Getting the p-value of the test based on a transformation to gamma variables ig_test(y)[[2]]$p.value # Example 2: testing the inverse Gaussian distribution hypothesis using "ratio" # option on a simulated data set. x <- rlnorm(500) # simulating a random sample from the lognormal distribution ig_test(x, method = "ratio")
# Example 1: testing the inverse Gaussian distribution hypothesis using "transf" # option on the compressive strength variable of the strength data set. data("strength") y <- strength$cstrength # compressive strength ig_test(y, method = "transf") # Getting the p-value of the test based on a transformation to gamma variables ig_test(y)[[2]]$p.value # Example 2: testing the inverse Gaussian distribution hypothesis using "ratio" # option on a simulated data set. x <- rlnorm(500) # simulating a random sample from the lognormal distribution ig_test(x, method = "ratio")
Transformation and ratio tests for the Laplace distribution by Gonzalez-Estrada and Villasenor (2016).
laplace_test(x, method = "transf", N = 10^5)
laplace_test(x, method = "transf", N = 10^5)
x |
a numeric data vector containing a random sample of real numbers. |
method |
the type of test to be performed. Two available options are |
N |
number of Monte Carlo samples used to approximate the p-value of the test when the |
When "transf"
option is chosen, a transformation to approximately exponential random variables is performed and the exponentiality hypothesis is assessed using Anderson-Darling test.
When "ratio"
option is chosen, a test based on the ratio of two estimators of the scale parameter is performed. For samples of size n < 500, the p-value of this test is approximated by Monte Carlo simulation. Otherwise, it is approximated by the standard normal cumulative distribution function.
A list with class "htest"
containing the following components.
statistic |
the calculated value of the test statistic. |
p.value |
approximated p-value of the test. |
method |
a character string giving the name of the method used for testing the null hypothesis. |
data.name |
a character string giving the name of the data set. |
Elizabeth Gonzalez-Estrada [email protected], Jose A. Villasenor
Gonzalez-Estrada, E. and Villasenor, J.A. (2016). A ratio goodness-of-fit test for the Laplace distribution. Statistics and Probability Letters, 119, 30-35. https://doi.org/10.1016/j.spl.2016.07.003
# Example 1: testing the Laplace distribution hypothesis using "transf" option x <- rnorm(50) # simulating a random sample from a normal distribution laplace_test(x) # Example 2: testing the Laplace distribution hypothesis using "ratio" option x <- rt(60,4) # simulating a random sample from Student's t distribution with 4 d.f. laplace_test(x, method = "ratio")
# Example 1: testing the Laplace distribution hypothesis using "transf" option x <- rnorm(50) # simulating a random sample from a normal distribution laplace_test(x) # Example 2: testing the Laplace distribution hypothesis using "ratio" option x <- rt(60,4) # simulating a random sample from Student's t distribution with 4 d.f. laplace_test(x, method = "ratio")
Test for the lognormal distribution based on a data transformation to normal observations.
lnorm_test(x)
lnorm_test(x)
x |
a numeric data vector containing a random sample of positive observations. |
Shapiro-Wilk test is used for testing normality on the transformed observations.
A list with class "htest"
containing the following components.
statistic |
the calculated value of the test statistic. |
p.value |
an approximated p-value of the test. |
method |
the character string "Test for the lognormal distribution based on a transformation to normality". |
data.name |
a character string giving the name of the data set. |
Elizabeth Gonzalez-Estrada, Jose A. Villasenor
Other tests for some alternative distributions to the lognormal model are impremented in functions ig_test
, gamma_test
and weibull_test
.
# Testing the lognormal distribution hypothesis on the compressive strength variable # of the strength data set. data("strength") x <- strength$cstrength # compressive strength lnorm_test(x) # testing the lognormal distribution hypothesis
# Testing the lognormal distribution hypothesis on the compressive strength variable # of the strength data set. data("strength") x <- strength$cstrength # compressive strength lnorm_test(x) # testing the lognormal distribution hypothesis
A generalization of Shapiro-Wilk test for multivariate normality (Villasenor-Alva and Gonzalez-Estrada, 2009).
mvshapiro_test(X)
mvshapiro_test(X)
X |
a numeric data matrix with d columns and n rows. |
Sample size (n) must be larger than vector dimension (d).
When d = 1, mvshapiro_test(X)
produces the same results as shapiro.test(X)
.
A list with class "htest"
containing the following components.
statistic |
the value of the generalized Shapiro-Wilk statistic for testing multivariate normality. |
p.value |
an approximated p-value of the test. |
method |
the character string "Generalized Shapiro-Wilk test for multivariate normality". |
data.name |
a character string giving the name of the data set. |
Elizabeth Gonzalez-Estrada [email protected], Jose A. Villasenor-Alva
Villasenor-Alva, J.A. and Gonzalez-Estrada, E. (2009). A generalization of Shapiro-Wilk's test for multivariate normality. Communications in Statistics: Theory and Methods, 38 11, 1870-1883. http://dx.doi.org/10.1080/03610920802474465
shapiro.test
and normal_test
for testing univariate normality.
# Example 1: Testing multivariate normality on iris.virginica # iris.virginica contains a set of measurements corresponding to # Iris virginica of famous iris data set. iris.virginica <- as.matrix(iris[iris$Species == "virginica", 1:4], ncol = 4) mvshapiro_test(iris.virginica) # Example 2: Testing multivariate normality on the goats dataset data(goats) mvshapiro_test(as.matrix(goats))
# Example 1: Testing multivariate normality on iris.virginica # iris.virginica contains a set of measurements corresponding to # Iris virginica of famous iris data set. iris.virginica <- as.matrix(iris[iris$Species == "virginica", 1:4], ncol = 4) mvshapiro_test(iris.virginica) # Example 2: Testing multivariate normality on the goats dataset data(goats) mvshapiro_test(as.matrix(goats))
Correlation test of fit for normality based on the Levy characterization (Villasenor-Alva and Gonzalez-Estrada, 2015).
normal_test(x, method = "cor")
normal_test(x, method = "cor")
x |
a numeric data vector containing a random sample of size n. |
method |
a character string giving the name of the test to be used. So far the only option is |
Sample size (n) must be an integer lying between 10 and 400.
The Levy characterization of the normal distribution states that sums of independent normal random variables are also normal random variables. Based on this property, the normality assumption might be judged by comparing sums of pairs of observations from a random sample to quantiles of the standard normal distribution. If normality holds then the pairs of sums and quantiles should lie on a straight line approximately. A formal test for normality is obtained when such a comparison is based on the sample correlation coefficient of sums and quantiles.
A list with class "htest"
containing the following components.
statistic |
the calculated value of the test statistic. |
p.value |
an approximated p-value of the test. |
method |
the character string "Correlation test for normality". |
data.name |
a character string giving the name of the data set. |
Elizabeth Gonzalez-Estrada [email protected], Jose A. Villasenor-Alva
Villasenor-Alva, J.A. and Gonzalez-Estrada, E. (2015). A correlation test for normality based on the Levy characterization. Communications in Statistics: Simulation and Computation, 44 5, 1225-1238. http://dx.doi.org/10.1080/03610918.2013.810261
data(goats) # loading the "goats" data set apply(goats,2,normal_test) # testing normality on each variable of the "goats" data set
data(goats) # loading the "goats" data set apply(goats,2,normal_test) # testing normality on each variable of the "goats" data set
Ozone levels in parts per million (ppm) registered in the southwest of Mexico City from January 1, 2008 to April 30th, 2016, which exceed the 0.165 ppm threshold.
data(o3)
data(o3)
A data frame with 47 observations on the following 2 variables.
date
date in the format yyyy-mm-dd
ozone_level
a numeric vector containing the ozone levels above 0.165 ppm
Atmospheric Monitoring Office of Mexico City.
data(o3) plot(o3)
data(o3) plot(o3)
Maximum ozone concentrations (in ppm) per month registered in the southwest of Mexico City from 2008 to 2015 during the months of March to May.
data(o3max)
data(o3max)
A data frame with 24 observations on the following 2 variables.
month
months in which observations were registered.
o3max_level
a numeric vector containing the maximum ozone leveles per month.
Atmospheric Monitoring Office of Mexico City.
data(o3max) plot(o3max)
data(o3max) plot(o3max)
Transformation test of fit for skew-normality (Gonzalez-Estrada and Cosmes, 2019).
sn_test(x, method = "transf")
sn_test(x, method = "transf")
x |
a numeric data vector containing a random sample of size n. |
method |
a character string giving the name of the test to be used. So far the only option is |
The random sample is transformed to approximately normal variables. Shapiro-Wilk test is used for testing normality.
The sample size should be larger than 50 in order to have a reasonable control of the type I error probability.
A list with class "htest"
containing the following components.
p.value |
an approximated p-value of the test. |
method |
the character string "Shapiro-Wilk test for skew-normal distributions". |
data.name |
a character string giving the name of the data set. |
Elizabeth Gonzalez-Estrada ([email protected])
Gonzalez-Estrada, E. and Cosmes, W. (2020). Shapiro-Wilk test for skew normal distributions based on data transformations. Journal of Statistical Computation and Simulation, 89 17, 3258-3272. https://doi.org/10.1080/00949655.2019.1658763
data(strength) # loading the "strength" data set y <- strength$strain sn_test(y) # testing skew normality on the strain variable
data(strength) # loading the "strength" data set y <- strength$strain sn_test(y) # testing skew normality on the strain variable
Compressive strength and strain of maize seeds.
data("strength")
data("strength")
A data frame with 90 observations on the following 2 variables.
strain
a numeric vector giving the relative change in length under compression stress in millimeters.
cstrength
a numeric vector giving the compressive strength in Newtons.
These data correspond to maize seeds with floury endosperm and 8% of moisture.
Mancera-Rico, A. (2014).
Mancera-Rico, A. (2014). Contenido de humedad y tipo de endospermo en la resistencia a compresion en semillas de maiz. Ph.D. Thesis. Colegio de Postgraduados, Mexico.
data(strength) plot(strength) # plot of "strain" versus "cstrength"
data(strength) plot(strength) # plot of "strain" versus "cstrength"
Test for the Weibull distribution based on a data transformation to observations with type I extreme value (Gumbel) distribution.
weibull_test(x, method = "transf", N = 1000)
weibull_test(x, method = "transf", N = 1000)
x |
numeric data vector containing a random sample of positive observations. |
method |
test to be used. So far, |
N |
number of Monte Carlo samples used to approximate the p-value of the test. Default is N = 1000. |
The "ratio"
test provided by function ev_test
for the type I extreme value distribution is applied to the transformed observations.
A list with class "htest"
containing the following components.
statistic |
the calculated value of the test statistic. |
p.value |
an approximated p-value of the test. |
method |
the character string "Test for the Weibull distribution". |
data.name |
a character string giving the name of the data set. |
Elizabeth Gonzalez-Estrada, Jose A. Villasenor
Other tests for positive datasets are provided by functions ig_test
, gamma_test
and lnorm_test
.
# Testing the Weibull distribution hypothesis on the maximum ozone levels given # in the o3max data set. data(o3max) x <- o3max[ ,2] # maximum ozone levels weibull_test(x, N = 10000)
# Testing the Weibull distribution hypothesis on the maximum ozone levels given # in the o3max data set. data(o3max) x <- o3max[ ,2] # maximum ozone levels weibull_test(x, N = 10000)