BookmarkSubscribe
Community Trekker

## Script for "Spline Predicted Values"

Greetings all,

Hoping that someone with more JMP script-writing experience can offer some suggestions here.

What I'd like to do is to fit Y by X by Group and Fit a Spline (0,1; Standardized), then save the predicted values in a new column of my current data table. I've been able to do the first part (fit the model and the spline), and I've seen that I could save the spline predicted values by a simple right-click on the red triangle but I don't want to do this manually. I'd like to do this automatically through a script.

When I select the "Save the predicted values" options in JMP Preferences (Platforms-Bivariate Curve), it works but it takes an extremely long time to proceed.

Finally, my Yvar are date and I'd like to assign the format "d/m/y" to the new created column.

Thank you so much for the help!

Pierre

1 ACCEPTED SOLUTION

Accepted Solutions
Community Manager

## Re: Script for "Spline Predicted Values"

Try something like this:

`dt = open("\$SAMPLE_DATA\Big Class.jmp");biv=dt << Bivariate(  Y( :height ),  X( :weight ),  Fit Spline( 0.1, Standardized, {Line Color( {208, 64, 86} )}, {Save Predicteds} ),  By( :age ));`

To format the column you can send the Format message to the new column, which will be the last column in the table.

`column(dt, ncol(dt))<< format("d/m/y");`

-Jeff

-Jeff
5 REPLIES 5
Community Manager

## Re: Script for "Spline Predicted Values"

Try something like this:

`dt = open("\$SAMPLE_DATA\Big Class.jmp");biv=dt << Bivariate(  Y( :height ),  X( :weight ),  Fit Spline( 0.1, Standardized, {Line Color( {208, 64, 86} )}, {Save Predicteds} ),  By( :age ));`

To format the column you can send the Format message to the new column, which will be the last column in the table.

`column(dt, ncol(dt))<< format("d/m/y");`

-Jeff

-Jeff
Community Trekker

## Re: Script for "Spline Predicted Values"

Thank you so much for the answer.

In fact, I found the {Save predicteds} option the day after my post, I tried it but it took a time as long as the "save the predicted values" option in JMP preferences while it's very quick with the manual way. The reason of the long process is certainly the high number of Data I have (around 550 groups and 18 000 rows...) because it works very well in the "Big class" exemple where there are a smaller number of rows than in my table.

I don't know why the scripting way is more than 10 times longer than the manual way...

Community Manager

## Re: Script for "Spline Predicted Values"

Hmmm...that's odd, but you're right. I built a table like you describe and I can see the same performance issue that you do.

I'll pass it along to our development staff and see if they have a suggestion and whether we can make it better in a future release.

I'm sorry for the difficulty.

-Jeff

-Jeff
Community Trekker

## Re: Script for "Spline Predicted Values"

Wondering if there is any update on this.  I'm having the same issue in JMP12 - the suggested syntax that seems the obvious thing to do is extremely slow on large data compared to carrying out the steps manually.  Is there some way to replicate the manual performance?  For example I will be trying making the plots with the fits then sending the message after the fact to get it to act more like when you use the red button if I can figure out some syntax for that.

Community Trekker

## Re: Script for "Spline Predicted Values"

Just wanted to add tested in JMP13 as well.  Issue appears to be the same.