Help using Base SAS procedures

Proc Multtest on non parametric data

Reply
Occasional Contributor
Posts: 18

Proc Multtest on non parametric data

Hi,

I have skewed data on which I want to perform multiple comparisons.

I accidentally performed parametric test which had the following code:

proc glm data=work PLOTS=(DIAGNOSTICS RESIDUALS);

class type;

model results=type;

estimate " " type 3 -1 -1 -1/e;

estimate " " type  -1 3 -1 -1/e;

estimate " " type -1 -1 3 -1/e;

estimate " " type  -1 -1 -1 3/e;

estimate " " type 2 0 -1 -1/e;

estimate " " type  0 0 -1 1/e;

estimate " " type -1 1 0 0/e;

run;

quit;

I now want to make the non-parametric version of that.... I don't know what to do Smiley Sad

So far I have:

PROC NPAR1WAY data=work wilcoxon;

Class TYPE;

Var results;

Run;

Which is fine, but then to make multiple comparisons I don't know what to do. 

Proc Multtest has been reccomended to me but I don't follow the syntax on the SAS site, and it all seems to give t-test results which seem imappropriate.  I am supposed to use the option "HOCHBERG" I believe.

Does anyone know how to help me?

Thanks Smiley Happy

Respected Advisor
Posts: 4,934

Re: Proc Multtest on non parametric data

Here is one way of doing all the tests and corrections (assuming variable type is numeric with values=1,2,3,4) :

data tests;
input testId $ type grp;
datalines;
test3111 1 1
test3111 2 2
test3111 3 2
test3111 4 2
test1311 1 2
test1311 2 1
test1311 3 2
test1311 4 2
test1131 1 2
test1131 2 2
test1131 3 1
test1131 4 2
test1113 1 2
test1113 2 2
test1113 3 2
test1113 4 1
test2011 1 2
test2011 3 1
test2011 4 1
test0011 3 1
test0011 4 2
test1100 1 1
test1100 2 2
;

proc sql;
create table workGrp as
select T.testId, T.grp, W.results
from work as W inner join tests as T
     on W.type=T.type
order by testId, grp;
quit;

proc npar1way data=workGrp wilcoxon;
by testId;
class grp;
var results;
ods output WilcoxonTest=Wtests;
run;

proc multtest HOCHBERG out=adjustedWtests
inpvalues(nValue1)=Wtests(where=(name1="P2_WIL"));
run;

proc print data=adjustedWtests; run;

PG

PG
Super User
Posts: 10,044

Re: Proc Multtest on non parametric data

PG,

There is no need to use proc npar1way since OP want  multiple comparisons , not two comparison.

proc glm is also a candidate .

Ksharp

Occasional Contributor
Posts: 18

Re: Proc Multtest on non parametric data

I have no idea what either of you are talking about.
PG Stats: Why would I use proc sql? I don't know what any of that code means.

Ksharp: It isn't a linear model, I have non normal data so how can I use proc glm? Deffo proc par1way.

Respected Advisor
Posts: 2,655

Re: Proc Multtest on non parametric data

Here is another approach.  Use PROC MIXED to analyze the ranks, rather than the raw results.  Something like:

proc rank data=work out=rankeddata;

var results;

ranks rank_result;

run;

/* Change to PROC MIXED to get LSMESTIMATEs, which can be adjusted for multiple comparisons, and to accommodate the comparisons which are not just one group to another.  Multiple comparisons are the stepdown Bonferroni (Holm) adjustment */

proc mixed data=rankeddata ;

class type;

model rank_result=type;

lsmestimate  type 'Type 1 vs mean of remaining' 3 -1 -1 -1,

lsmestimate  type 'Type 2 vs mean of remaining' -1 3 -1 -1,

lsmestimate  type 'Type 3 vs mean of remaining' -1 -1 3 -1,

lsmestimate  type 'Type 4 vs mean of remaining' -1 -1 -1 3,

lsmestimate  type 'Type 1 vs mean of types 3 and 4' 2 0 -1 -1,

lsmestimate  type 'Type 3 vs type 4' 0 0 -1 1,

lsmestimate  type 'Type 1 vs type 2' -1 1 0 0/adjust=bon stepdown;

ods output lsmestimates=lsmestimates;

run;

/* If you want the Hochberg adjustment, then add the following.  See Example  61.5 Inputting Raw p-Values in the MULTTEST Procedure documentation.  In particular, read the last paragraph in this example, describing some general assumptions regarding the methods of adjustment */

/* First, pare down the lsmestimates dataset to just the labels and the p values */

data lsmestimates_for_multtest;

set lsmestimates;

raw_p=probt;

keep label raw_p;

run;

/*Now run the adjustments.  This will give adjustments using the stepdown Bonferroni (Holm, same as in PROC MIXED, hopefully), Hochberg and false discovery rate methods*/

proc multtest inpvalues=lsmestimates_for_multtest holm hoc fdr;

run;

Good luck.

Steve Denham

Message was edited by: Steve Denham

Respected Advisor
Posts: 4,934

Re: Proc Multtest on non parametric data

In my code above, many versions of your data are created, one for each of your estimate statements. In each version, the data is divided in two groups. Then npar1way is called to do all the Wilcoxon tests and multtest is called to correct the p-values for multiple testing.

PG

PG
Ask a Question
Discussion stats
  • 5 replies
  • 1475 views
  • 0 likes
  • 4 in conversation