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: How to run nonlinear model with custom formula?

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

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

Oct 31, 2013 5:32 AM
(7022 views)

Hi

I have been looking at the example in https://communities.sas.com/message/134652#134652 to try to understand how to set up a nonlinear model with a custom formula. Unfortunately the script from the example does run when I pasted it directly into my script window. (Note, that I created the dataset and saved it in a datatable, which become the Current Data Table. Then I just ran the parts of the scipts that had to do with the modelling.)

I get an error, when the script comes to the line, starting with parms:

** **

parms = rnlin1[/*###*/"Nonlinear Fit ID=1"]["Solution"][Table Box( 2 )] <<make combined data table;

The problem is connected with a more general one, that I have, regarding how to formulate you own formulas to fit data to. I simply do not see how to do it. I used to use proc nlin in SAS, which was straight forward and had good examples, but I am at a loss here. What do I enter in the Formula column? And where are the parameters? In a separate Datatable? Or?

Regards

Poul

** **

** **

1 ACCEPTED SOLUTION

Accepted Solutions

Highlighted

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

The parameters are defined in the formula editor by choosing "Parameters" in the upper left dropdown menu. Then the formula is entered as usual using the parameters and independent variable.

The formula in the example table you refer to can be added in this way by JSL:

dt = New Table**(** "nonlin example",

Add Rows**(** **20** **)**,

New Column**(** "ID",

Numeric,

Continuous,

Format**(** "Best", **1** **)**,

Set Values**(** **[****1**, **1**, **1**, **1**, **1**, **1**, **1**, **1**, **1**, **1**, **2**, **2**, **2**, **2**, **2**, **2**, **2**, **2**, **2**, **2****]** **)**

**)**,

New Column**(** "x",

Numeric,

Continuous,

Format**(** "Best", **12** **)**,

Set Values**(** **[****1**, **2**, **3**, **4**, **5**, **6**, **7**, **8**, **9**, **10**, **1**, **2**, **3**, **4**, **5**, **6**, **7**, **8**, **9**, **10****]** **)**

**)**,

New Column**(** "y",

Numeric,

Continuous,

Format**(** "Best", **12** **)**,

Set Values**(**

**[****14.007192425**, **17.212873694**, **19.206116204**, **22.698900479**, **26.547313123**, **27.964537384**,

**32.187880488**, **34.471305291**, **37.982516136**, **39.725363966**, **18.727600524**, **20.500227504**,

**18.715068521**, **22.667963466**, **25.505984818**, **25.947839552**, **27.933068812**, **31.390339224**,

**32.390010591**, **34.514002505****]**

**)**

**)**

**)**;

dt << **New Column****(** "Formula", numeric, Formula**(** Parameter**(** **{**b0 = **1**, b1 = **2****}**, b0 + b1 * :x **)** **)** **)**;

4 REPLIES 4

Highlighted

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

The parameters are defined in the formula editor by choosing "Parameters" in the upper left dropdown menu. Then the formula is entered as usual using the parameters and independent variable.

The formula in the example table you refer to can be added in this way by JSL:

dt = New Table**(** "nonlin example",

Add Rows**(** **20** **)**,

New Column**(** "ID",

Numeric,

Continuous,

Format**(** "Best", **1** **)**,

Set Values**(** **[****1**, **1**, **1**, **1**, **1**, **1**, **1**, **1**, **1**, **1**, **2**, **2**, **2**, **2**, **2**, **2**, **2**, **2**, **2**, **2****]** **)**

**)**,

New Column**(** "x",

Numeric,

Continuous,

Format**(** "Best", **12** **)**,

Set Values**(** **[****1**, **2**, **3**, **4**, **5**, **6**, **7**, **8**, **9**, **10**, **1**, **2**, **3**, **4**, **5**, **6**, **7**, **8**, **9**, **10****]** **)**

**)**,

New Column**(** "y",

Numeric,

Continuous,

Format**(** "Best", **12** **)**,

Set Values**(**

**[****14.007192425**, **17.212873694**, **19.206116204**, **22.698900479**, **26.547313123**, **27.964537384**,

**32.187880488**, **34.471305291**, **37.982516136**, **39.725363966**, **18.727600524**, **20.500227504**,

**18.715068521**, **22.667963466**, **25.505984818**, **25.947839552**, **27.933068812**, **31.390339224**,

**32.390010591**, **34.514002505****]**

**)**

**)**

**)**;

dt << **New Column****(** "Formula", numeric, Formula**(** Parameter**(** **{**b0 = **1**, b1 = **2****}**, b0 + b1 * :x **)** **)** **)**;

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

Re: How to run nonlinear model with custom formula?

MS, thanks. The example works, of course.

Could you explin what the code:

rnlin1=Report(nlin[1]);

parms = rnlin1[ . . . .]

does? I see, that it generates the parms table, but otherwise, the syntax look strange, to me at least.

Regards

Poul

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

Re: How to run nonlinear model with custom formula?

The first command creates a reference to a report. Here, nlin is the nonlinear platform object, and since it has a By() variable it is here made up by two "subreports", one for each level of ID. The first of these subreports is adressed by the index [1].

The second command merely set the path to a table within the subreport and sends a "make combined datatable" command to it which should create one datatable with all similar table boxes within the report.

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

Re: How to run nonlinear model with custom formula?

Hi again, I am still grabbling with understanding how to get the results from a report into a data table. The syntax eludes me. I want to develop a generic way of accessing the results of for instance a Bivariate report or a Nonlinear report. I have looked at the scripting guides chapter on display trees, and I think that is where the information is. But how to get hold of a specific result?

For instance this generic situation, where my_data has X-variable and Y-variable columns:

my_data<<Bivariate(Y(:y-variable),X(:x-variable),

Fit Line,

Fit Polynomial (2),

Fit Polynomial (3),

By (:number_of_instruments));

How can I access the results embedded in the report and excute a Make CombinedDataTable?

Regards

Poul