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.
"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.
@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.
Show us the output you get.
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
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?"
The NORMAL option of PROC UNIVARIATE will cause a goodness-of-fit to the normal distribution to be computed.
Brilliant. Is there an option in sas studio to do this without typing in any form of coding?
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.
@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.
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 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.