BookmarkSubscribeRSS Feed
laurenhosking
Quartz | Level 8

I have a set of data imported how would I perform I goodness of fit test on certain columns of the table. I don’t know where to start. 

17 REPLIES 17
PaigeMiller
Diamond | Level 26

"Goodness-of-fit" test needs context. Without that context, there is no answer.

 

Sometimes you are testing to see how well data comes from a theoretical distribution (such as the normal distribution). Other times you are testing how well a statistical model fits the data.

--
Paige Miller
laurenhosking
Quartz | Level 8

@PaigeMiller I manages to do this test and get an output with 3 different tests and there p vales. How would I interoperate this to establish wether it not they were a sample from a normal distribution. 

PaigeMiller
Diamond | Level 26

Show us the output you get.

--
Paige Miller
laurenhosking
Quartz | Level 8

height sas.png

PaigeMiller
Diamond | Level 26

SAS provides three different tests for goodness-of-fit to a normal distribution, the Kolmogorov-Smirnov, Cramer-von-Mises and the Anderson-Darling. Each tests to see if the hypothesis that the data is from a normal distribution, or not. While I can't really explain the differences, they all say the same thing ... since the p-values are >0.05, you do not reject the hypothesis that the data came from a normal distribution (or in layman's terms, the data is consistent with a normal distribution). You can read more about Kolmogorov-Smirnov here: https://blogs.sas.com/content/iml/2019/05/15/kolmogorov-d-statistic.html

--
Paige Miller
ballardw
Super User

What kind of goodness of fit?

 

Against a known distribution such as "Is my variable normally distributed with specific mean and standard deviation?" or similar information for other distributions.

 

Or "Is my variable A in the data distributed similar to Variable X in this data?"

 

 

laurenhosking
Quartz | Level 8
I’m honestly not sure I think that’s the issue I’m having but the question says
” Use Goodness of fit test to establish if height (ht) and weight (wt) were
sample from a normal distributed population”
PaigeMiller
Diamond | Level 26

The NORMAL option of PROC UNIVARIATE will cause a goodness-of-fit to the normal distribution to be computed.

https://documentation.sas.com/?docsetId=procstat&docsetTarget=procstat_univariate_syntax01.htm&docse...

--
Paige Miller
laurenhosking
Quartz | Level 8

Brilliant. Is there an option in sas studio to do this without typing in any form of coding?

PaigeMiller
Diamond | Level 26

I can't answer SAS Studio questions if they do not involve writing code. I simply don't use SAS Studio for any other purpose than writing code.

--
Paige Miller
laurenhosking
Quartz | Level 8
’m honestly not sure I think that’s the issue I’m having but the question says
” Use Goodness of fit test to establish if height (ht) and weight (wt) were
sample from a normal distributed population”
laurenhosking
Quartz | Level 8
If you can explain it in code that would help also. I’m just used to using the task bar for most things however I’m open to learning the code
ballardw
Super User

@laurenhosking wrote:
If you can explain it in code that would help also. I’m just used to using the task bar for most things however I’m open to learning the code

Basic code to test for normal distribution of one or more variables.

proc univariate data=sashelp.class normal;
   var height weight;
run;

The NORMAL option on the proc statement requests the tests for normality of the variables on the Var statement.

You will get the typical Univariate output of summary moments, statistics, quantiles and extreme plus a table with tests for normality.

laurenhosking
Quartz | Level 8

Hi this is really helpful! Just to clarify, I’ll have one set of  table for height one set of tables for weight 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 17 replies
  • 3185 views
  • 5 likes
  • 3 in conversation