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
- /
- Analytics
- /
- Stat Procs
- /
- Performing a Levene's test and Shapiro Wilk test

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

07-21-2016 12:45 AM

Hi, I have a pretty basic question although I am struggling to answer it. I am new to SAS. I want to carry out a Levene's test and Shapiro Wilk test for variance and normality of some data. It looks as though the Shapiro Wilk can by done using the Univariate procedure or the Model procedure. The Univariate seems the more straight forward of the two. I am having a lot of trouble structuring the data that I want the tests performed on. To illustrate my question, let's say I have an experiment with two within subject factors, each with two levels. The dependent variable is performance time to complete a reaction time task. I have this data collated on a table with four columns: participant_ID, factor_1, factor_2 and Reaction_time. I have 10 participants. Each participant has entries on four rows, with a reaction time for each condition/combination of each factor, so "factor_1" can be either "level_1" or "level_2" and "factor_2" can be either "level_1" or "level_2". I want to assess the normality of the 10 participants'' reaction times for each condition, and the equality of variances of the 10 participants' reaction times between the four conditions. I can't find a simple way to do this. Can you help? Kind regards, Alexa.

Accepted Solutions

Solution

07-21-2016
11:13 PM

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

07-21-2016 01:47 PM

Remember, the assumption for ANOVA is NOT that the data are normally distributed, but that the errors are normally distributed. A test of the data will probably lead you to a horrible place. Consider the following: You measure height in males and females. If you just test height for normality, it will likely fail, because you have a bimodal distribution. However, after removing the effect of sex and looking at the residuals for normality, you will likely see that a normal distribution fits pretty well, and so your assumptions are met.

Now, you can do all of this in a straightforward way, using as @Ksharp said, PROC GLM and PROC UNIVARIATE. Try the following

```
proc glm data=yourdata;
class factor1 factor2;
model reactiontime = factor1*factor2; /* You need to look at a model with only the interaction, as Levene's test only applies to a one-way ANOVA)*/
means agegroup / hovtest=levene(type=abs) welch;
output out=resids r=residual;
run;
proc univariate data=resids normal;
var residual;
run;
```

Now, as far as your data are concerned, this is a good start at looking at some key factors. However, your design is such that you may want to approach the analysis a bit differently.

But that is a topic for another day.

Steve Denham

All Replies

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

07-21-2016 01:27 AM

proc univariate can perform Normal Test.

proc glm can perform equal variance test(Levene's test).

proc univariate data=sashelp.class normal;

class sex;

var _numeric_;

run;

proc glm data=upsit;

class agegroup;

model smell = agegroup;

means agegroup / hovtest welch;

run;

Solution

07-21-2016
11:13 PM

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

07-21-2016 01:47 PM

Remember, the assumption for ANOVA is NOT that the data are normally distributed, but that the errors are normally distributed. A test of the data will probably lead you to a horrible place. Consider the following: You measure height in males and females. If you just test height for normality, it will likely fail, because you have a bimodal distribution. However, after removing the effect of sex and looking at the residuals for normality, you will likely see that a normal distribution fits pretty well, and so your assumptions are met.

Now, you can do all of this in a straightforward way, using as @Ksharp said, PROC GLM and PROC UNIVARIATE. Try the following

```
proc glm data=yourdata;
class factor1 factor2;
model reactiontime = factor1*factor2; /* You need to look at a model with only the interaction, as Levene's test only applies to a one-way ANOVA)*/
means agegroup / hovtest=levene(type=abs) welch;
output out=resids r=residual;
run;
proc univariate data=resids normal;
var residual;
run;
```

Now, as far as your data are concerned, this is a good start at looking at some key factors. However, your design is such that you may want to approach the analysis a bit differently.

But that is a topic for another day.

Steve Denham

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

07-21-2016 11:18 PM

Dear Ksharp and Steve

Thanks for the help. Appreciated.

Kind regards, Alexa.

Thanks for the help. Appreciated.

Kind regards, Alexa.