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
- :
- Can I apply a formula in formula editor by a varia...

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
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Feb 16, 2016 6:01 AM
(493 views)

In my data table I have data over time for several different items (indicated by color names for this question). There are 125 time points and data for each color at each time point. I want to create a formula in a new column that will give me the slope of the data for each color listed under the name column. I can easily put a formula for slope in a new column but do not know how to apply that formula by the name.

I added the fit Y by X of the data below. Basically I just need a way to save the slopes of all those lines into a data table.

3 REPLIES

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

Feb 16, 2016 6:41 AM
(361 views)

In Y by X if you used the "Group By" and then fit your lines you have a number of summary tables in your output. Right click on the Parameter estimate table and select "Make Combined Data Table". This will give you a table the parameter estimate output that includes each group.

Alternatively, if you use Fit Model with a By variable then you could broadcast (command key on a mac) the Save Columns>Prediction Formula and obtain a column in your original table with a formula for each group (color) item (it will be a big if then type formula).

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

Feb 17, 2016 12:19 AM
(361 views)

karen@boulderstats is right, I would like to offer another option:

using the fit model platform, if color is used as a dummy variable and an interaction with the slope you practically get a separate prediction for each category. at this stage, you can save the prediction formula as follows:

dt = Open**(** "$SAMPLE_DATA/Drug.jmp" **)**;

obj = Fit Model**(**

Y**(** :y **)**,

Effects**(** :Drug, :x, :Drug * :x **)**,

Personality**(** Standard Least Squares **)**,

Emphasis**(** Minimal Report **)**,

Run

**)**;

obj << **Prediction Formula**;

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

Feb 17, 2016 3:01 AM
(361 views)

Here is my script that will pull off the slopes for each of the groupings and place it into an output table

Names Default To Here**(** **1** **)**;

dt = Open**(** "$SAMPLE_DATA/Semiconductor Capability.jmp" **)**;

// Find the number of groupings, to allow for the stripping

// off of each slope from the Fit Y by X

Summarize**(** dt, ByGroup = By**(** :Site **)** **)**;

// Run the Fit Y by X(Bivariate)

Biv = Bivariate**(** Y**(** :NPN1 **)**, X**(** :PNP1 **)**, Group By**(** :Site **)**, fit line **)**;

// Create a list to store the slopes in

SlopeList = **{}**;

// Pass through the bivariate ouput scraping off the slopes

For**(** i = **2**, i <= N Items**(** ByGroup **)** * **4** - **2**, i = i + **4**,

Insert Into**(**

SlopeList,

Num**(**

Word**(** **4**, Report**(** Biv **)[**Outline Box**(** i **)][**Text Box**(** **1** **)]** << **get text**, " *" **)** ||

Word**(** **5**, Report**(** Biv **)[**Outline Box**(** i **)][**Text Box**(** **1** **)]** << **get text**, " *" **)**

**)**

**)**;

**)**;

// Create a new table with the slopes

dt2=New Table**(**"Slopes",New Column**(**"Group",character,values**(**ByGroup**))**,

New Column**(**"Slope",values**(**SlopeList**))**

**)**;

Jim