Skip to contents

Performs the D'Agostino test for normality, which is particularly suitable for large sample sizes where other tests like Shapiro-Wilk may be too sensitive.

Usage

dagostino.test(x)

Arguments

x

a numeric vector of data values. Missing values are allowed and will be removed.

Value

A list with class "htest" containing the following components:

statistic

a named vector containing three test statistics:

Skewness

the Z statistic for skewness test

Kurtosis

the Z statistic for kurtosis test

Omnibus

the chi-squared statistic combining both tests

parameter

the degrees of freedom for the omnibus test

p.value

a named vector containing three p-values corresponding to the statistics

method

the character string "D'Agostino Normality Test"

data.name

a character string giving the name(s) of the data

alternative

a character string describing the alternative hypothesis

estimates

a named vector containing sample statistics:

n

sample size

Skewness

sample skewness coefficient

Kurtosis

sample kurtosis coefficient (excess kurtosis)

Mean

sample mean

SD

sample standard deviation

Details

The D'Agostino test is a powerful omnibus test for normality that combines separate tests for skewness and kurtosis. It is based on the transformation of the sample skewness and kurtosis to approximate normal distributions, which are then combined into a chi-squared statistic.

This test is particularly recommended for:

  • Large sample sizes (n > 50)

  • Situations where Shapiro-Wilk test is overly sensitive

  • Testing both tail behavior and symmetry simultaneously

The test has good power against a wide range of alternative distributions and is less sensitive to sample size fluctuations than many other normality tests.

See also

Other normality_test: ad.test(), cvm.test(), jb.test.modified(), pearson.test(), sf.test()

Examples

if (FALSE) { # \dontrun{
# Test normally distributed data
set.seed(123)
normal_data <- rnorm(100)
result <- dagostino.test(normal_data)
print(result)

# Test non-normal data (exponential distribution)
non_normal_data <- rexp(100)
result2 <- dagostino.test(non_normal_data)
print(result2)

# Access specific components
result$p.value["Omnibus"]  # Overall test p-value
result$estimates["Skewness"]  # Sample skewness
result$statistic["Kurtosis"]  # Kurtosis test statistic

# Large sample performance
large_sample <- rnorm(5000)
dagostino.test(large_sample)
} # }