Programming the statistical procedures from SAS

Pair-wise Comparisons in Nonparametric One-Way ANOVA.

Reply
Respected Advisor
Posts: 3,773

Pair-wise Comparisons in Nonparametric One-Way ANOVA.

Where there are more than 2 levels of treatments and you want pairwise comparisons is it correct to run NPAR1WAY for each pair of treatments.  I want to produce p-value combinations similar to LSMEANS TRT / DIFF;

Example program of my proposed pairwise calls to NPAR1WAYs.  Is this a valid statistical analysis?  Keep in mind I only have an 8th grade education. :smileyshocked:

Anyone know anything about this?  I would appreciate your input.

proc plan seed=997015200;

   factors id=10 ordered trt=4 y=1 of 50 / noprint;

   output out=sample trt cvals=('A' 'B' 'C' 'D');

   run;

   quit;

proc sort;

   by id trt;

   run;

proc print;

   run;

proc npar1way data=sample;

   class trt;

   var y;

   run;

proc sql feedback;

   create view pairedV1 as

   select a.id,a.trt as trt1,a.y as y1,b.trt,b.y

      from sample as a, sample as b

      where a.id eq b.id

            and a.trt gt b.trt

      order by b.trt,a.trt,a.id

      ;

   quit;

data paired(keep=pairID trt y id);

   set pairedV1;

   length pairID $3;

   pairID = catx('-',trt,trt1);

   output;

   y     =  y1;

   trt   =  trt1;

   output;

   run;

proc print;

   run;

*ods listing close;

*ods trace on;

proc npar1way data=paired wilcoxon;

   by pairID;

   class trt;

   var y;

   ods output WilcoxonScores=WilcoxonScores WilcoxonTest=WilcoxonTest;

   run;

*ods trace off;

ods listing;

proc print data=WilcoxonTest;

   run;

Message was edited by: data _null_

Grand Advisor
Posts: 16,880

Pair-wise Comparisons in Nonparametric One-Way ANOVA.

Typically when you run multiple pairwise comparisons you don't need to adjust your calculations but you do need to adjust your cutoff point. Bonferonni corrections are common, but there are more out there that might make sense depending on exactly what you're testing.

http://en.wikipedia.org/wiki/Multiple_comparisons

Grand Advisor
Posts: 9,451

Pair-wise Comparisons in Nonparametric One-Way ANOVA.

Where there are more than 2 levels of treatments and you want pairwise comparisions is it.

You can't use proc npar1way for this situation. npar1way only is used for two levels. If you use it for more than two levels ,then the Alpha(the probability of the first type of error) will be unrespected, because you compare them many times.

You should use proc glm.

Ksharp

Respected Advisor
Posts: 3,773

Re: Pair-wise Comparisons in Nonparametric One-Way ANOVA.

How about this using SCORES=DATA of ranked pooled data.

proc plan seed=997015200;

   factors id=10 ordered trt=3 y=1 of 50 / noprint;

   output out=sample trt cvals=('A' 'B' 'C');

   run;

   quit;

proc rank data=sample out=sample;

   var y;

   ranks yr;

   run;

proc print;

   run;

title 'Scored from proc';

proc npar1way data=sample ks;

   class trt;

   var y;

   run;

title 'Scores=data';

proc sql feedback;

   create view pairedV1 as

   select a.id,a.trt as trt1,a.yR as y1,b.trt,b.yR

      from sample as a, sample as b

      where a.id eq b.id

            and a.trt gt b.trt

      order by b.trt,a.trt,a.id

      ;

   quit;

data paired(keep=pairID trt yR id);

   length pairID $3;

   pairID = 'ABC';

   do until(eof1);

      set sample end=eof1;

      output;

      end;

   do until(eof2);

      set pairedV1 end=eof2;

      pairID = catx('-',trt,trt1);

      output;

      yR     =  y1;

      trt   =  trt1;

      output;

      end;

   stop;

   run;

proc print;

   run;

proc npar1way data=paired scores=data;

   by pairID notsorted;

   class trt;

   var yR;

   *ods output

      DataScores=DataScores

      DataScoresAnalysis=DataScoresAnalysis

      DataScoresTest=DataScoresTest

      ;

   run;

Grand Advisor
Posts: 9,451

Re: Pair-wise Comparisons in Nonparametric One-Way ANOVA.

I think it is no. You should use proc glm. It is not business about using parameter method or non-parameter method.

Respected Advisor
Posts: 3,773

Pair-wise Comparisons in Nonparametric One-Way ANOVA.

Bump.

Esteemed Advisor
Posts: 7,057

Pair-wise Comparisons in Nonparametric One-Way ANOVA.

DN,

I'll leave it to the statisticians to disagree with me, but I think that the critical question is how one intends on using the findings.  I.e., do you need defensible p values or are you only snooping for differences and are willing to accept chance differences as being real?

If you need defensible p values, I'd have to agree with everyone that this wouldn't be an acceptable method. However, if you are just data snooping, don't have a problem with sometimes accepting differences that aren't really there, but are most interested in "describing" the data you have, I don't see we your proposed method wouldn't be justifiable.

Ask a Question
Discussion stats
  • 6 replies
  • 1127 views
  • 0 likes
  • 4 in conversation