IMSL Statistics Reference Guide > Goodness of Fit > CHI_SQUARED_NORMALITY_TEST Function (PV-WAVE Advantage)
  

CHI_SQUARED_NORMALITY_TEST Function (PV-WAVE Advantage)
Performs a chi-squared test for normality.
Usage
result = CHI_SQUARED_NORMALITY_TEST (n_categories, x)
Input Parameters
n_categories—Number of cells into which the observations are to be tallied. n_categories must be at least 2.
x—Array of size n_observations (number of observations) containing the observations.
Returned Value
result—The p-value for the chi-squared test for normality. An approximate probability is computed.
Input Keywords
Double—If present and nonzero, then double precision is used.
Output Keywords
Chi_squared—Named variable into which the scalar float containing the chi-squared test statistic is stored.
Deg_freedom—Named variable into which the scalar float containing the degrees of freedom for the chi-squared goodness-of-fit test is stored.
Discussion
This function computes the chi-squared statistic, its p-value, and the degrees of freedom of the test. The n_categories parameter finds the number of intervals into which the observations are to be divided. The intervals are equiprobable except for the first and last interval, which are infinite in length.
If more flexibility is desired for the specification of intervals, the same test can be performed with a call to the CHISQTEST Function (PV-WAVE Advantage) using the keywords described for that function.
Example
This example is taken from Conover (1980, pp. 195, 364). The data consists of 50 two-digit numbers taken from a telephone book. Since p_value is greater than 0.1 the chi-squared test fails to reject the null hypothesis of normality.
PRO t_chi_squared_normality_test_ex1 
 
  n_observations = 50
  n_categories = 6
  x = [ $
        23.0, 36.0, 54.0, 61.0, 73.0, 23.0,$  
        37.0, 54.0, 61.0, 73.0, 24.0, 40.0,$  
        56.0, 62.0, 74.0, 27.0, 42.0, 57.0,$   
        63.0, 75.0, 29.0, 43.0, 57.0, 64.0,$   
        77.0, 31.0, 43.0, 58.0, 65.0, 81.0,$   
        32.0, 44.0, 58.0, 66.0, 87.0, 33.0,$   
        45.0, 58.0, 68.0, 89.0, 33.0, 48.0,$   
        58.0, 68.0, 93.0, 35.0, 48.0, 59.0,$    
        70.0, 97.0] 
 
  p_value = CHI_SQUARED_NORMALITY_TEST( n_categories,$
                                                   x,$
                                      Deg_freedom=df,$
                              Chi_squared=chi_squared)
 
  print,"p-value = ", $
         STRING(p_value, Format="(f11.4)") 
  print,"degrees of freedom = ", $
         STRING(df,Format="(f11.4)") 
  print,"chi squared test = ",$
         STRING(chi_squared,Format="(f11.4)") 
 
END
Output
p-value =      0.4208
degrees of freedom =    5.0000
chi squared test =      4.9600

Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.