Performs the goodness-of-fit test based on empirical distribution function to check if an i.i.d sample follows a Normal distribution.
testNormal(
x,
ngrid = length(x),
gridpit = TRUE,
hessian = FALSE,
method = "cvm"
)
A list of two containing the following components:
Statistic: the value of goodness-of-fit statistic.
p-value: the approximate p-value for the goodness-of-fit test based on empirical distribution function. if method = 'cvm' or method = 'ad', it returns a numeric value for the statistic and p-value. If method = 'both', it returns a numeric vector with two elements and one for each statistic.
a non-empty numeric vector of sample data.
the number of equally spaced points to discretize the (0,1) interval for computing the covariance function.
logical. If TRUE
(the default value), the parameter ngrid is ignored and (0,1) interval is divided
based on probability inverse transformed values obtained from the sample. If FALSE
, the interval is divided into ngrid
equally spaced points for computing the covariance function.
logical. If TRUE
the Fisher information matrix is estimated by the observed Hessian Matrix based on
the sample. If FALSE
(the default value) the Fisher information matrix is estimated by the variance of the
observed score matrix.
a character string indicating which goodness-of-fit statistic is to be computed. The default value is 'cvm' for the Cramer-von-Mises statistic. Other options include 'ad' for the Anderson-Darling statistic, and 'both' to compute both cvm and ad.
set.seed(123)
sim_data <- rnorm(n = 50)
testNormal(x = sim_data)
sim_data <- rgamma(50, shape = 3)
testNormal(x = sim_data)
Run the code above in your browser using DataLab