Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Programming
- /
- SAS Studio
- /
- Goodness of fit test

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 12-30-2019 04:34 PM
(3668 views)

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

"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

Paige Miller

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Show us the output you get.

--

Paige Miller

Paige Miller

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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

Paige Miller

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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?"

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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”

” Use Goodness of fit test to establish if height (ht) and weight (wt) were

sample from a normal distributed population”

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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

--

Paige Miller

Paige Miller

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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

Paige Miller

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

’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”

” Use Goodness of fit test to establish if height (ht) and weight (wt) were

sample from a normal distributed population”

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

@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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Are you ready for the spotlight? We're accepting content ideas for **SAS Innovate 2025** to be held May 6-9 in Orlando, FL. The call is **open **until September 25. Read more here about **why** you should contribute and **what is in it** for you!

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.