BookmarkSubscribeRSS Feed
cpd47
Calcite | Level 5

Hi,

 

I'm not sure if it is possible to run a 2-way nonparametric analysis (a lot of sources on the internet say only 1-way is possible), but I have some response variables that fail the Shapiro-Wilk test for normality so I am trying to analyze them non parametrically. Below is a sample of my data and how I am analyzing variables that ARE normally distributed and have equal variances. However, this response variable (osmo) fails both Shapiro-Wilk and Levene's tests for normality and homogeneity of variance. I also attached a SAS file to this question (I am new here so am not sure which is preferred). If anyone has an idea of how to do this, I would greatly appreciate any help!

 

data osmo;
input trt time tank osmo;
datalines;
1 0 1 297
1 0 1 293.5
1 0 2 301.5
1 0 2 298.5
1 0 3 299
1 0 3 314.5
1 20 1 297.5
1 20 1 .
1 20 2 291.5
1 20 2 298.5
1 20 3 290
1 20 3 299
1 60 1 305
1 60 1 297
1 60 2 .
1 60 2 295.5
1 60 3 291
1 60 3 298
1 120 1 295.5
1 120 1 298
1 120 2 296.5
1 120 2 293
1 120 3 299
1 120 3 305.5
1 360 1 329.5
1 360 1 287.5
1 360 2 291
1 360 2 303.5
1 360 3 297
1 360 3 290
1 1440 1 301
1 1440 1 294.5
1 1440 2 300.5
1 1440 2 291.5
1 1440 3 296
1 1440 3 303
2 0 1 299
2 0 1 307.25
2 0 2 299.5
2 0 2 326
2 0 3 295
2 0 3 310
2 20 1 .
2 20 1 291.5
2 20 2 .
2 20 2 291.5
2 20 3 292
2 20 3 .
2 60 1 313.5
2 60 1 305.5
2 60 2 310.5
2 60 2 .
2 60 3 306
2 60 3 300
2 120 1 316
2 120 1 .
2 120 2 287
2 120 2 286
2 120 3 282
2 120 3 300.5
2 360 1 304
2 360 1 298.5
2 360 2 306
2 360 2 .
2 360 3 299
2 360 3 312
2 1440 1 346.5
2 1440 1 286.5
2 1440 2 299.5
2 1440 2 337
2 1440 3 287
2 1440 3 309
3 0 1 305
3 0 1 302.5
3 0 2 308
3 0 2 322
3 0 3 316.5
3 0 3 335
3 20 1 298
3 20 1 296
3 20 2 299.5
3 20 2 306
3 20 3 291.5
3 20 3 302.5
3 60 1 304.5
3 60 1 312.5
3 60 2 303.5
3 60 2 292.5
3 60 3 301
3 60 3 294
3 120 1 306
3 120 1 303
3 120 2 .
3 120 2 .
3 120 3 304
3 120 3 324
3 360 1 304
3 360 1 312
3 360 2 306.5
3 360 2 308.5
3 360 3 306.5
3 360 3 318
3 1440 1 300.5
3 1440 1 293.5
3 1440 2 311
3 1440 2 266
3 1440 3 289
3 1440 3 297
;
proc print; run;

/*testing normality and variance*/
proc glm data=osmo;
class trt time;
model osmo = trt*time;
means trt*time/hovtest=levene (type=abs);
output out=outosmo r=resid;
run; quit;
proc univariate data=outosmo normal;
var resid;
run; quit;
proc univariate data=outosmo noprint;
histogram resid;
run; quit;

/*This is how I am analyzing my variables that pass normality and variance.
However, I have been unable to transform this and other variables to meet normality
and variance assumptions. Looking for a nonparametric way to analyze*/
proc glm data=osmo;
class trt time tank;
model osmo=trt time trt*time tank(trt);
test h=trt time trt*time e=tank(trt);
lsmeans trt time trt*time/pdiff adjust=tukey e=tank(trt) lines;
run; quit;

6 REPLIES 6
Reeza
Super User

I've moved your question to the Statistical Procedures forum so hopefully you get a better response.

 

I'm going to ask a dumb question here, what type of model are you trying to create and what are the assumptions behind that model?

cpd47
Calcite | Level 5

Thank you! I meant to post it in that forum but somehow didn't.

 

That is a really good question. I'm not sure which type of model I am trying to create. That's probably the question I should have asked. I guess I'm looking for some type of nonparametric equivalent to the model I attached, if such a thing exists. I believe Kruskall-Wallis is applicable for 1-way analyses, but I'm trying to see if I can analyze the factors "trt" and "time" as well as the interaction of "trt*time."

Reeza
Super User

I think you should post what your data actually is and what your hypothesis is and we can make suggestions from there.

cpd47
Calcite | Level 5

The data I attached is from an experiment where I am measuring the stress response of 3 types of fish (trt: 1, 2, 3) over a 1440 minute (24 hour) time period. Fish were divided into 9 tanks (12 fish per tank, 3 tanks per fish type) and were chased for 1 minute using dip nets to elicit a stress response. At each time point since the chasing (time: 0, 20, 60, 120, 360, 1440 minutes) blood was sampled from 2 fish in each tank. I measured many response variables, but "osmo" (osmolality) is the one I provided in my post.

 

I hypothesize:

a) trt: 2 fish will exhibit significantly lower levels of osmo than trt: 1 and trt: 3 fish

b) trt: 1 fish will not differ from trt: 3 fish

c) there will be no interaction between trt and time

 

 

lvm
Rhodochrosite | Level 12 lvm
Rhodochrosite | Level 12

If you serarch SAS Communities, you will find several older postings about rank-based analysis of factorials. Brunner and several colleagues have devleloped methods that can be done in SAS MIXED (with the right options, after ranking the data). Don't confuse this with rank transformation method (where one just ranks data and proceeds with GLM). You need to choose other options for unequal variances. Old postings, including by me, give some code.

cpd47
Calcite | Level 5

Thank you! I will search around and see what I can find.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 6 replies
  • 1420 views
  • 2 likes
  • 3 in conversation