turn on suggestions

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

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS Procedures
- /
- PROC Univariate - Goodness of fit

Topic Options

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-10-2015 09:09 AM

The P-Value and statistic value obtained for 3 Goodness of fit tests (Kolmogrov-Smirnov, Cramer-Von-Mises and Ander-Darling test) doesn't match with the value calculated from Matlab software.

Probably the table used for calculation of P-Value (or Critical value) is different because the formula for calculation of Test statistics seems to be same.

Can one guide with the table used for calculation of P-value in each test. Or wat else could be the problem....something that I'm missing on.... Plz help!!!

Results from SAS | ||||

Goodness-of-Fit Tests for Lognormal Distribution | ||||

Test | Statistic | p Value | ||

Kolmogorov-Smirnov | D | 0.0819588 | Pr > D | <0.010 |

Cramer-von Mises | W-Sq | 0.2144147 | Pr > W-Sq | <0.005 |

Anderson-Darling | A-Sq | 1.2362929 | Pr > A-Sq | <0.005 |

Results from Matlab | ||||

Goodness-of-Fit Tests for Lognormal Distribution | ||||

Test | Statistic | p Value | ||

Kolmogorov-Smirnov | D | 0.082 | Pr > D | 0.1237 |

Cramer-von Mises | W-Sq | 0.2935 | Pr > W-Sq | 0.141 |

Anderson-Darling | A-Sq | 1.2409 | Pr > A-Sq | 0.0031 |

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Lidz

08-11-2015 02:01 PM

How did you get SAS to give the p values, which are ordinarily for tests of normality? Did you pre-transform the data, such as adding a constant, and then taking the log? Or am I missing something new in PROC UNIVARIATE?

If you are transforming, check what goes in, especially the constant to eliminate zeroes. Different values will definitely affect how this will work. And what kind of results are you seeing for the Wilcoxon test?

Steve Denham

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Lidz

08-12-2015 09:00 AM

Showing your program statement is always helpful to those who are trying to answer your questions.

Regarding "Why are they different," it is hard to say since I don't know what commands you submitted in SAS, nor what you did in MATLAB. One possibility is that SAS is very careful to adjust the the test based on the number of known and unknown parameters. Thus you will get a different test statistic for each of the following four tests. Not all software takes known parameters into account.

proc univariate data=sim;

var x;

histogram x/

gamma(alpha=EST sigma=EST) /* 0 parameters known */

gamma(alpha=4 sigma=EST) /* 1 shape param known */

gamma(alpha=EST sigma=1) /* 1 scale param known */

gamma(alpha=4 sigma=1); /* 2 parameters known */

run;

@SteveDenham The UNIVARIATE procedure produces GOF statistics, including p-values for many non-normal distributions based on the ECDF. The details of the GOF tests in SAS are available in the documentation. For distributions for which the distribution of the Kolmogorov-D or Anderson-Darling W statistics is not known asymptotically, resampling methods are used to estimate p-values. You can control the number of bootstrap resamples by using the EDFNSAMPLE= option.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Rick_SAS

08-13-2015 07:26 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Rick_SAS

08-13-2015 09:11 AM

Both the parameters are unknwn.

I used following program in SAS:

ods select ParameterEstimates GoodnessOfFit ;

proc univariate data= Test;

var x1;

histogram / lognormal

ods output parameterestimates= Param_est

run;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Lidz

08-13-2015 10:54 AM

Is x1 the only variable in the Test data set? If not, you might be looking at the EDF test for a different variable. To make sure, use

histogram x1 / lognormal;

The SAS documentation says that the p-value uses "probability levels similar to those given by D’Agostino and Stephens (1986)." When you tell us what MATLAB commands you are using, perhaps a comparison will be possible.