I am trying to create a script to take the p-value from the oneway analysis and drop that into a new column in the table used for the analysis.
I looked over the JMP 13 scripting guide and on page 690, there is "Extract Values from an Analysis into a Report" which seems to be what I want. However following that as a guide, it does not appear to work with oneway and anovas...
Here is the listed script I modified to work with the bigclass sample dataset while I was trying to troubleshoot the code:
Deletesymbols();
dt=Open("$SAMPLE_DATA\Big Class.jmp");
//creates a oneway analysis of big class similar how my data will be interpreted
anova=Oneway(
Y(:height),
X(:age),
With Control(1, {12}),
Means(1), Mean Diamonds(1), Comparison Circles(1),
By(:sex)
);
anova<<show tree structure;
/*
Female LDS threshold results are in OultineBox(9), Levels (age) is StringColBox(5), pValues are NumberColBox(15)
Male LDS threshold results are in OultineBox(18), Levels (age) is StringColBox(10), pValues are NumberColBox(30)
*/
// Should create a report that I can use to extract data from the anova analysis based off the original script
report(anova) [Outline Box(9)] << Close( 0 ); <br>report(anova) [Outline Box(18)] << Close( 0 );
reportanova = anova << Report;
// Should extract the level (age) and pvalues for females
agef = reportanova[Outline Box(9)][String Col Box(5)] << Getaslist;
pvalsf = reportanova[Outline Box(9)][NumberColBox(15)] << Getaslist;
// Should extract the level (age) pvalues for males
agem = reportanova[Outline Box(18)][String Col Box(10)] << Getaslist;
pvalsm = reportanova[Outline Box(18)][NumberColBox(30)] << Getaslist;
//column creation to recieve extracted data
dt<<new column("p-value",Numeric, "Continuous");
//should add the collected p-value to the data table in the new column, matched to the correct row based on sex and age <font color="#FF0000">(untested)</font>.
For Each Row( p-value =
match(sex,
"f",match(age,
show(agef[1]),show(pvalsf[1]),
show(agef[2]),show(pvalsf[2]),
show(agef[3]),show(pvalsf[3]),
show(agef[4]),show(pvalsf[4]),
show(agef[5]),show(pvalsf[5]),
show(agef[6]),show(pvalsf[6]),
),
"m",match(age,
show(agem[1]),show(pvalsm[1]),
show(agem[2]),show(pvalsm[2]),
show(agem[3]),show(pvalsm[3]),
show(agem[4]),show(pvalsm[4]),
show(agem[5]),show(pvalsm[5]),
show(agem[6]),show(pvalsm[6]),
),
);*/
But the embedded log has an error when putting the anova into a report:
Send Expects Scriptable Object in access or evaluation of 'Send' , Report( anova )[Outline Box( 9 )] << /*###*/Close( 0 ) /*###*/
The debugger fails at the same place and gives these as the variables:
Variable Value
anova {Oneway[], Oneway[]}
dt Data Table("big Class")
reportanova {DisplayBox[OutlineBox], DisplayBox[OutlineBox]}
So I can only guess that what works with Bivariate does not extend to Oneway. I even changed the variables, shortening anova to anov in case it was a variable/command/something mismatch, but it continues to fail. There was a previous post from 2011 with a sample code, but it was garbled with font info that wouldn't clear up in word, a jmp script window, or saving as a html file so I could actually read it...
This I have to solve before I can see if my code to add the p-value to the correct row works...
Thanks.
... View more