cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar

dynamic Y variable for oneway analysis

Hi everybody,

 

I am trying to script a dynamic Y variable for oneway analysis, then output the mean into a combined table. Is this a correct way to do so ?

dt = Data Table ("Analysis");
ColNamesList = d1 << get column names (string );
For( i = N Items( ColNamesList ), i >= 1, i--,
OW = (dt << Oneway( Y( Column(ColNamesList) ),
	   X(:SITE),
	   Mean ( 1 ),
	   Automatic Recalc( 0 )
	 )) << Report;
);
dtCombined = Report( OW[1] )[Table Box( 1 )] << Make Combined Data Table;

Thanks in advance !

 

 

 

4 REPLIES 4
pauldeen
Level VI

Re: dynamic Y variable for oneway analysis

Run it: is it working for your table?

If yes, this is a correct way to do it!

If not, let us know where you run into trouble?

Re: dynamic Y variable for oneway analysis

Sorry, I accidentally clicked on the solution button.

 

The script did not prompt any error. But, there was also no graph seen as an output.

The script log only shows scriptable. 

Georg
Level VII

Re: dynamic Y variable for oneway analysis

Dear @XiangCD_MP_User , I had several issues with your script. If I got your task, it is doing a oneway analysis for each continuous column of the data table by :site, and saving the data table with the mean.

If so, I would do it like follows:

Alternatively there are other possiblities, e.g. putting all together in one "Fit Group" statement. The best way depends on your scripting skills, and what exact environment it should run in. 

 

Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA\Big Class.jmp" );
// dt = Data Table ("Analysis");

OW_lst = {};

ColNamesList = dt << get column names( string, "Continuous" );

// When using single report windows, you would need to collect the result table from each of them
/*
For( i = N Items( ColNamesList ), i >= 1, i--,
	Insert Into( OW_lst, dt << Oneway( Y( Column( ColNamesList[i] ) ), X( :sex ), Means( 1 ), Automatic Recalc( 0 ) ) )
);
*/

// Generate new report window to collect all analyses
nw = New Window( "Oneway Collection",
	hlb = H List Box(
		For( i = N Items( ColNamesList ), i >= 1, i--, 
		// collect references to each analysis in OW_lst
			Insert Into( OW_lst, dt << Oneway( Y( Column( ColNamesList[i] ) ), X( :sex ), Means( 1 ), Automatic Recalc( 0 ) ) )
		)
	)
);

// Message will collect all similar tables in one data table
dtCombined = Report( OW_lst[1] )[Table Box( 1 )] << Make Combined Data Table;

// Alternatively you would be able to get the same result w/o working with a list like follows
//(nw << XPATH( "//TableBox" ))[2] << Make Combined Data Table;
Georg

Re: dynamic Y variable for oneway analysis

@XiangCD_MP_User ,

 

You might try using Response Screening under the Analyze>Screening menu.  You can still pass in the list of column names into the Y variable place holder. The output of Response Screening will allow an option in the red triangle to save means for each X level or a Pvalues table that has the mean for each Y.

 

Also, if you find all of the columns that match a string and put them into a list (which looks like what you are doing), you can use the variable name (using Eval()) within the Y variable of Response Screening. Or you can group them into a column group and reference the column group within Response Screening. Effectively it will do the loop like you want and it is dynamic.

 

Something Like:

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Probe.jmp" );
dt << Response Screening(
	X( :Process ),
	Y( Column Group( "Responses" ) ),
    PValues Table on Launch( 1 ),
	Save Means
); 

 

This outputs the p-values as well as the mean of Y for each comparison.

 

Chris Kirchberg, M.S.2
Data Scientist, Life Sciences - Global Technical Enablement
JMP Statistical Discovery, LLC. - Denver, CO
Tel: +1-919-531-9927 ▪ Mobile: +1-303-378-7419 ▪ E-mail: chris.kirchberg@jmp.com
www.jmp.com