cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
wu
wu
Level III

How to save predicted values into matrix or list without saving into existing data table

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
obj = Bivariate( Y( :Weight ), X( :Height ) )<<Group by(:sex);;
obj<<Fit spline(0.1, Standardized,{Save Predicteds});

tried lis below , it won't work.

val_predict_ls=obj<<Save Predicteds. 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: How to save predicted values into matrix or list without saving into existing data table

I am not sure how to create the matrix without creating the column in the data table, but here is a method that functionally will do what you want

Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

// Get the groupings for the sex column
Summarize( dt, bysex = by( :sex ) );
obj = Bivariate( Y( :Weight ), X( :Height ) ) << Group by( :sex );
obj << Fit spline( 0.1, Standardized, {Save Predicteds} );

// Create the matricies for the groups and delete the
// columns from the data table
For( i = N Items( bysex ), i >= 1, i--,
	Eval(
		Parse(
			bysex[i] ||
			"_Predicted_Matrix = column(dt,N Col(dt))<<get values;"
		)
	);
	dt << delete columns( N Cols( dt ) );
);
Show( f_Predicted_Matrix, m_Predicted_Matrix );
Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: How to save predicted values into matrix or list without saving into existing data table

I am not sure how to create the matrix without creating the column in the data table, but here is a method that functionally will do what you want

Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

// Get the groupings for the sex column
Summarize( dt, bysex = by( :sex ) );
obj = Bivariate( Y( :Weight ), X( :Height ) ) << Group by( :sex );
obj << Fit spline( 0.1, Standardized, {Save Predicteds} );

// Create the matricies for the groups and delete the
// columns from the data table
For( i = N Items( bysex ), i >= 1, i--,
	Eval(
		Parse(
			bysex[i] ||
			"_Predicted_Matrix = column(dt,N Col(dt))<<get values;"
		)
	);
	dt << delete columns( N Cols( dt ) );
);
Show( f_Predicted_Matrix, m_Predicted_Matrix );
Jim
wu
wu
Level III

Re: How to save predicted values into matrix or list without saving into existing data table

Thanks.
My attempt was trying get the a few key summary values like mean, sigma etc from a group of predicted values based on a large data base.
Looks like, need to go your way by saving into data table, then deleted them.