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
- :
- Nonlinear Script

Topic Options

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

Highlighted

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

Dec 9, 2016 4:43 PM
(4723 views)

Performing NLR via the Platform on a data table generates the expected results (see Croucher http://... [didnt see how to attach table but I can send as needed.]

I have used similar scripts [change data and equation] with no issue.

The equation section of the script is: Parameter( {b0 = 1, b1 = 0.2},

b0 * Cosine( b1 * :X ) + b1 * Sine( b0 * :X ))

```
Clear Log(); Clear Globals();
xv = [ -2, -1.64, -1.33, -.07, 0, 0.45, 1.2, 1.64, 2.32, 2.9];
yv = [.699369,.700462,.695354,1.030905,1.97389,2.411430,1.910910,0.919576,-0.770975,-1.42001];
dt = New Table( "Croucher Data",
New Column( "x", SetValues( xv ) ),
New Column( "y", SetValues( yv ) ),
); //close New Table
dt <<
Nonlinear(
Y( :y ),
X( :x ),
Model( Parameter( {b0 = 1., b1 = 0.2},
b0 * Cosine( b1 * :x ) + b1 * Sine( b0 * :x ) ) ),
QuasiNewton SR1,Finish,plot(1),
Confidence Limits
);//close NonLinear
```

1 ACCEPTED SOLUTION

Accepted Solutions

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

Your script works well. There a slight difference in the input data if compared with the linked example (cf. xv[4] & yv[9]).

It is also possible to do this nonlinear fit without using the platform:

```
Model = Expr(
b0 * Cosine(b1 * xv) + b1 * Sine(b0 * xv)
);
xv = [-2, -1.64, -1.33, -0.7, 0, 0.45, 1.2, 1.64, 2.32, 2.9];
yv = [0.699369, 0.700462, 0.695354, 1.03905, 1.97389, 2.41143, 1.91091, 0.919576, -0.730975, -1.42001];
b0 = 1;
b1 = 0.2;
SSE = Minimize(Sum((Model - yv) ^ 2), {b0, b1});
Eval List({b0, b1, SSE});
```

4 REPLIES

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

Your script works well. There a slight difference in the input data if compared with the linked example (cf. xv[4] & yv[9]).

It is also possible to do this nonlinear fit without using the platform:

```
Model = Expr(
b0 * Cosine(b1 * xv) + b1 * Sine(b0 * xv)
);
xv = [-2, -1.64, -1.33, -0.7, 0, 0.45, 1.2, 1.64, 2.32, 2.9];
yv = [0.699369, 0.700462, 0.695354, 1.03905, 1.97389, 2.41143, 1.91091, 0.919576, -0.730975, -1.42001];
b0 = 1;
b1 = 0.2;
SSE = Minimize(Sum((Model - yv) ^ 2), {b0, b1});
Eval List({b0, b1, SSE});
```

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

Thanks much for the script. It works fine for me. I've not used that function much but it obviously is ideal for many models.

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

Looks like one of your x values should be -0.7, not -0.07,

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

Thanks, typing issue! I fixed them for my file.