Table of Contents
The Chi-Square Goodness of Fit Test is a statistical method used to determine if observed data fits a specific theoretical distribution. In SAS, this test can be performed by following a few simple steps.
Firstly, the data should be organized in a frequency table with the observed values in one column and the expected values in another column. The expected values can be calculated based on a specific theoretical distribution or by creating a custom distribution.
Next, the “PROC FREQ” procedure should be used to perform the Chi-Square Goodness of Fit Test. This procedure is specifically designed for frequency data analysis and allows for the inclusion of expected values.
The syntax for the “PROC FREQ” procedure in SAS includes specifying the data set and variables to be used, as well as the expected values if applicable. The output of this procedure will include the Chi-Square statistic, degrees of freedom, and the associated p-value.
Finally, the results of the test can be interpreted by comparing the p-value to a predetermined significance level. If the p-value is less than the significance level, it can be concluded that the observed data does not fit the specified theoretical distribution. On the other hand, if the p-value is greater than the significance level, it can be concluded that the observed data does fit the specified theoretical distribution.
In summary, the Chi-Square Goodness of Fit Test can be easily performed in SAS by using the “PROC FREQ” procedure and interpreting the results to determine the fit of observed data to a specific theoretical distribution.
Perform a Chi-Square Goodness of Fit Test in SAS
A is used to determine whether or not a follows a hypothesized distribution.
The following example explains how to perform a Chi-Square Goodness of Fit Test in SAS.
Example: Chi-Square Goodness of Fit Test in SAS
A shop owner claims that an equal number of customers come into his shop each weekday. To test this hypothesis, a researcher records the number of customers that come into the shop in a given week and finds the following:
- Monday: 50 customers
- Tuesday: 60 customers
- Wednesday: 40 customers
- Thursday: 47 customers
- Friday: 53 customers
Use the following steps to perform a Chi-Square goodness of fit test in SAS to determine if the data is consistent with the shop owner’s claim.
Step 1: Create the dataset.
First, we’ll create a dataset and name it my_data:
/*create dataset*/
data my_data;
input Day $ Customers;
datalines;
Mon 50
Tue 60
Wed 40
Thur 47
Fri 53
;
run;
/*print dataset*/
proc printdata=my_data;
Step 2: Perform the Chi-Square Goodness of Fit Test.
Next, we’ll use the following code to perform a Chi-Square Goodness of Fit test:
/*perform Chi-Square Goodness of Fit test*/
proc freqdata=my_data;
tables Day / chisq;
weight Customers;
run;
From the output we can see:
- The Chi-Square test statistic: 4.36
- The corresponding p-value: 0.3595
Recall that a Chi-Square Goodness of Fit Test uses the following null and alternative :
- H0: A variable follows a hypothesized distribution.
- HA: A variable does not follow a hypothesized distribution.
Since the (.3595) is not less than 0.05, we fail to reject the null hypothesis.
This means we do not have sufficient evidence to say that the true distribution of customers is different from the distribution that the shop owner claimed.
Additional Resources
The following tutorials provide additional information about the Chi-Square Goodness of Fit test:
Cite this article
stats writer (2024). How do I perform a Chi-Square Goodness of Fit Test in SAS?. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-do-i-perform-a-chi-square-goodness-of-fit-test-in-sas/
stats writer. "How do I perform a Chi-Square Goodness of Fit Test in SAS?." PSYCHOLOGICAL SCALES, 1 Jul. 2024, https://scales.arabpsychology.com/stats/how-do-i-perform-a-chi-square-goodness-of-fit-test-in-sas/.
stats writer. "How do I perform a Chi-Square Goodness of Fit Test in SAS?." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/how-do-i-perform-a-chi-square-goodness-of-fit-test-in-sas/.
stats writer (2024) 'How do I perform a Chi-Square Goodness of Fit Test in SAS?', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-do-i-perform-a-chi-square-goodness-of-fit-test-in-sas/.
[1] stats writer, "How do I perform a Chi-Square Goodness of Fit Test in SAS?," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, July, 2024.
stats writer. How do I perform a Chi-Square Goodness of Fit Test in SAS?. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.
