Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- JMP User Community
- :
- Discussions
- :
- Discussions
- :
- Re: Changes to Least squares solve function in JMP14

Topic Options

- Start Article
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Oct 30, 2018 12:46 PM
(1149 views)

Hi all,

I scratched my head trying to find out why a script I posted here was not functioning on someone else's computer when it was working flawlessly on mine. It turns out that the order of the X and Y variables in the Least Squares Solve function in JSL has been inverted in JMP 14 relative to JMP 13. Naturally, this renders my initial script unusable for anyone using a JMP version <14, which is a bit annoying. Are these subtle changes documented somewhere?

Best regards, Yves

1 ACCEPTED SOLUTION

Accepted Solutions

Highlighted
Solution

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

That would be very frustrating. I'm sorry to hear that's how you discovered the change in the Least Squares Solve() JSL function.

Swapping the order of parameters in a JSL function like this is extraordinarily rare. When a change disrupts compatibility with previous versions, we list it in the Release Notes.

We're in an active development environment at JMP, but do our best to also maintain backward compatibility. You're correct that the order of parameters changed from JMP 13.0 (when the function was introduced) to 14.0. Not only that, but by default, Least Squares Solve() in 14.0 includes an intercept term.

There were a number of reasons motivating the change. First, Least Square Solve() was introduced (by me) in JMP 13.0, so it was not in circulation for long. Second, I switched the order and the default intercept term in tandem so that in nearly all use cases, Least Squares Solve() should result in a script not running rather than in incorrect numbers, the latter of which would be particularly hard to discover. Third, in 14.0, I introduced the JSL function Linear Regression(), which essentially solves the same problem as Least Squares Solve(), but with a more user-friendly access to standard output from a linear regression (e.g. standard errors, t-tests, R^2, etc.). With this new function, it made more sense to order the parameters as y, X, since it solves a y=Xb problem. Because of the similarities between these two functions, we elected to have them behave in the same way, with the parameters in the same order.

I went back and forth on the decision to switch the ordering for Least Squares Solve() so that it matched Linear Regression(), but I ended up making the call on switching it, since for JMP 14 and on, it seemed cleaner and more intuitive.

If you really want a script to run in either JMP 13 or JMP 14 using Least Squares Solve(), you could do something like:

```
Names Default To Here(1);
// generate data
```

random reset(123);
x = j(10,2,random normal());
beta = [1, 2];
y = x * beta + j(10,1,random normal(0,.2) );

// check version
jmpver = num(left(jmpversion(),2));
if(jmpver >= 14,
Least Squares Solve(y, X, <<nointercept),

// where in latest versions, the parameter order is switched

// and an intercept is added by default
/*else if*/ jmpver == 13,
Least Squares Solve(X, y)

// this function was introduced in JMP 13.0 with limited functionality
);

5 REPLIES 5

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Changes to Least squares solve function in JMP14

~~Can you provide some examples of the syntax here that behaves differently between JMP 13 and JMP 14? I'm not aware of any change that was made in this area, certainly not one that was done on purpose.~~

Sorry, I just re-read your message. I missed that you were referring to the Least Squares Solve() function. I was looking at the Fit Least Squares platform.

Let me investigate.

-Jeff

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Changes to Least squares solve function in JMP14

FYI, I noticed the change in the Scripting Index of the two JMP versions.

Highlighted
Solution

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

That would be very frustrating. I'm sorry to hear that's how you discovered the change in the Least Squares Solve() JSL function.

Swapping the order of parameters in a JSL function like this is extraordinarily rare. When a change disrupts compatibility with previous versions, we list it in the Release Notes.

We're in an active development environment at JMP, but do our best to also maintain backward compatibility. You're correct that the order of parameters changed from JMP 13.0 (when the function was introduced) to 14.0. Not only that, but by default, Least Squares Solve() in 14.0 includes an intercept term.

There were a number of reasons motivating the change. First, Least Square Solve() was introduced (by me) in JMP 13.0, so it was not in circulation for long. Second, I switched the order and the default intercept term in tandem so that in nearly all use cases, Least Squares Solve() should result in a script not running rather than in incorrect numbers, the latter of which would be particularly hard to discover. Third, in 14.0, I introduced the JSL function Linear Regression(), which essentially solves the same problem as Least Squares Solve(), but with a more user-friendly access to standard output from a linear regression (e.g. standard errors, t-tests, R^2, etc.). With this new function, it made more sense to order the parameters as y, X, since it solves a y=Xb problem. Because of the similarities between these two functions, we elected to have them behave in the same way, with the parameters in the same order.

I went back and forth on the decision to switch the ordering for Least Squares Solve() so that it matched Linear Regression(), but I ended up making the call on switching it, since for JMP 14 and on, it seemed cleaner and more intuitive.

If you really want a script to run in either JMP 13 or JMP 14 using Least Squares Solve(), you could do something like:

```
Names Default To Here(1);
// generate data
```

random reset(123);
x = j(10,2,random normal());
beta = [1, 2];
y = x * beta + j(10,1,random normal(0,.2) );

// check version
jmpver = num(left(jmpversion(),2));
if(jmpver >= 14,
Least Squares Solve(y, X, <<nointercept),

// where in latest versions, the parameter order is switched

// and an intercept is added by default
/*else if*/ jmpver == 13,
Least Squares Solve(X, y)

// this function was introduced in JMP 13.0 with limited functionality
);

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Changes to Least squares solve function in JMP14

Many thanks Milo for your detailed explanation. Just one more question: it seems that in JMP 14, wether the X matrix is augmented (with an initial column of 1s) is immaterial to the solution. Is this the case also with JMP 13? I don't have access anymore to JMP 13 except through an independent user who was using my script. I will follow your solution with regards to checking which JMP version it is.

Thanks again

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Changes to Least squares solve function in JMP14

Thanks for your understanding. No, that is not the case in JMP 13. The intercept term would need to be added manually (by pre-pending a column of 1s).