cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Sign-in to the JMP Community will be unavailable intermittently Dec. 6-7 due to a system update. Thank you for your understanding!
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.
  • JMP 19 is here! Learn more about the new features.

Discussions

Solve problems, and share tips and tricks with other JMP users.
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.

Recommended Articles