turn on suggestions

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

Showing results for

- JMP User Community
- :
- Discussions
- :
- post hoc tests for nonparametric data

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
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Sep 10, 2010 7:13 AM
(951 views)

I have a sinking feeling there is no quick fix to this but does anybody know how to run post hoc tests for nonparametric data in JMP? I am trying to compare 3 groups for differences in mean values such as visual acuity and neither the data nor the residuals are normally distributed in every instance. I have been performing Kruskal-Wallis analyses and then excluding groups to make the comparisons between 2 groups at a time. The problem is that this introduces type I error and, if the data were normally distributed, I would do a post hoc test to control for this.

What options are there to do this in JMP - if any?

Pulling my hair out with frustration at present.

Thanks for your time.

Neil

3 REPLIES

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Sep 19, 2010 4:21 AM
(259 views)

// Start of program;

DataFile = PickFile("Select Raw Data Table for Kruskal-Wallis Test:",, {"JMP Files|JMP"});

dt = open( DataFile );

dt << minimize window;

VarList = ColumnDialog(Title("Assign Roles:"),

Xfac = ColList("Factor ID", Min Col(1), Max Col(1)),

Yvar = ColList("Response(s)", Min Col(1), DataType(Numeric)),

);

Column(dt, Char(VarList["Xfac"][1])) << data type("Character");

Column(dt, Char(VarList["Xfac"][1])) << set modeling type("Nominal");

xCol = Column(dt, VarList["Xfac"]);

Response_List = VarList["Yvar"];

yCols = {};

for(i=1, i<=nItems(VarList["Yvar"]), i++,

insert into(yCols, Column(dt, Response_List[i]))

);

summarize(xLev=by(xCol)); // We'll need a list of the factor levels later, so create it now;

dt << select all rows;

dts = dt << subset(visible);

dto = Oneway(

Y( eval list( yCols ) ), X( eval list( xCol ) ),

Wilcoxon Test( 1 ), Box Plots( 0 ), Mean Diamonds( 0 ), invisible

);

dtoreport = dto << report;

// DTOREPORT will only be a list if there are at least two response variables;

if(islist(dtoreport),

chisqd = dtoreport[1][NumberColBox(5)] << MakeCombinedDataTable,

chisqd = dtoreport[NumberColBox(5)] << MakeCombinedDataTable

);

dtoreport << close window;

chisqd << add multiple columns("With", 1, Before First, Character);

chisqd << add multiple columns("Compare", 1, Before First, Character);

for(i=1, i<=nrow(chisqd), i++,

column(chisqd, "Compare")[i] = "All"; column(chisqd, "With")[i] = "All"

);

/*

We'll get a different set of summary statistics depending on whether xLev has more

than two levels or not, because if xLev > 2 then it's a chi-squared test, whereas

if there are only two levels the 2-sample test returns a Z statistic.

*/

if(nItems(xLev) > 2,

chisqd << delete columns({"ChiSquare", "DF"});

column(chisqd, "Prob>ChiSq") << set name("P Value");

,

chisqd << delete columns({"s", "Z"});

column(chisqd, "Prob>|Z|") << set name("P Value");

);

chisqd << select all rows;

Significances = chisqd << subset(visible);

close(chisqd, nosave);

Significances << set name("Significances");

column(Significances, "P Value") << format("Fixed Dec", 20, 4);

close(dts, nosave);

/*

Now run every pairwise comparison of all the levels of Xfac,

and append each of them in turn to Significances;

*/

if(nItems(xLev) > 2,

xName = Column(dt, VarList["Xfac"]) << get name;

for(k=1, k<=nItems(xLev)-1, k++,

for(l=k+1, l<=nItems(xLev), l++,

dt << select all rows;

TextToParse = "dt << select where((:" || xName || "==\!"" || xLev[k]

|| "\!")|(:" || xName || "==\!"" || xLev[l] || "\!"));";

// show(TextToParse);

eval(parse(TextToParse));

dts = dt << subset(invisible);

dts << set name("DTS");

xCol = Column(dts, VarList["Xfac"]);

Response_List = VarList["Yvar"];

yCols = {};

for(i=1, i<=nItems(VarList["Yvar"]), i++,

insert into(yCols, Column(dt, Response_List[i]))

);

dto = dts << Oneway(

Y( eval list( yCols ) ), X( eval( xCol ) ),

Wilcoxon Test( 1 ), Box Plots( 0 ), Mean Diamonds( 0 ), invisible

);

dtoreport = dto << report;

// DTOREPORT will only be a list if there are at least two response variables;

if(islist(dtoreport),

chisqd = dtoreport[1][NumberColBox(5)] << MakeCombinedDataTable,

chisqd = dtoreport[NumberColBox(5)] << MakeCombinedDataTable

);

chisqdi = chisqd << subset(invisible);

close(chisqd, nosave);

chisqdi << delete columns({"s", "Z"});

column(chisqdi, "Prob>|Z|") << set name("P Value");

column(chisqdi, "P Value") << format("Fixed Dec", 20, 4);

close(dts, nosave);

chisqdi << add multiple columns("With", 1, Before First, Character);

chisqdi << add multiple columns("Compare", 1, Before First, Character);

for(i=1, i<=nrow(chisqdi), i++,

column(chisqdi, "Compare")[i] = xLev[k]; column(chisqdi, "With")[i] = xLev[l]

);

Significances << Concatenate( chisqdi, Append to First Table );

close(chisqdi, nosave);

)

)

);

// Add a column of significance codes for P <= 0.05 = "*", P <= 0.01 = "**", P <= 0.001="***";

Significances << new column("Sig", Character(10));

for(i=1, i<=nrow(Significances), i++,

column(Significances, "Sig")[i] = if(column(Significances, "P Value")[i] <= 0.001, "***",

if(column(Significances, "P Value")[i] <= 0.01, "**",

if(column(Significances, "P Value")[i] <= 0.05, "*", "")

)

)

);

close(dt, nosave);

// End of program;

edit (Save) required to reset formatting

Message was edited by: ForumAdmin@sas

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Sep 19, 2010 4:53 AM
(259 views)

Regards, David

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Sep 23, 2010 6:21 AM
(259 views)