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
- :
- Actual by predicted plot of specific model

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
- Permalink
- Email to a Friend
- Report Inappropriate Content

Mar 16, 2017 9:19 AM
(2169 views)

Hello,

I have a column (type formula) which corresponds to the model of another column (response).

I would like to know if it is possible to graph the actual by predicted plot considering as "actual" the response column and the column which contains the formula as the "predicted".

I only see these graph when the model is defined by jmp.

Thanks in advance.

Solved! Go to Solution.

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Mar 16, 2017 9:56 AM
(4156 views)

This could be done with column formulas but it would get messy. This script should do the trick:

```
dlg = Column Dialog(
Title( "Evaluate Model" ),
yCol = Col List( "Response",
Data Type( Numeric ),
Min Col( 1 ),
Max Col( 1 )
),
mCol = Col List( "Model",
Data Type( Numeric ),
Min Col( 1 ),
Max Col( 1 )
)
);
If( dlg["Button"] == -1,
Throw( "User cancelled" );
);
Remove From( dlg );
Eval List( dlg );
dt = Current Data Table();
response = yCol[1] << Get As Matrix;
model = mCol[1] << Get As Matrix;
residual = model - response;
sst = Sum( (response - Mean( response ) )^2 );
sse = Sum( residual^2 );
ssm = sst - sse;
r square = ssm / sst;
dt << New Column( "Residual", Values( residual ) );
New Window( "Evaluate Model",
dt << Graph Builder(
Variables( X( mCol[1] ), Y( yCol[1] ) ),
Elements( Points( X, Y, Legend( 3 ) ) ),
Show Control Panel( 0 )
),
dt << Graph Builder(
Variables( X( :Residual ), Y( yCol[1] ) ),
Elements( Points( X, Y, Legend( 3 ) ) ),
Show Control Panel( 0 )
),
Text Box( "R square is " || Char( r square ) )
);
```

Learn it once, use it forever!

4 REPLIES

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Mar 16, 2017 9:23 AM
(2166 views)

I think the solution might be simple.

- Select Graph > Graph Builder.
- Select the observed response and drag it to the Y drop zone.
- Select the model column and drag it to the X drop zone.

Let me know if I over-simplified your request.

Learn it once, use it forever!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Mar 16, 2017 9:30 AM
(2163 views)

Hello,

Thank's for your answer. I think I did not explain very well my objective.

What I want to do, it is to evaluate my model. I would like to define the RSquare value of the model (if it is possible) and obtain the residual by predicted plot. Something like the jmp report for the fit least squares but considering the model that I defined as a formula.

Kind regards

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Mar 16, 2017 9:56 AM
(4157 views)

This could be done with column formulas but it would get messy. This script should do the trick:

```
dlg = Column Dialog(
Title( "Evaluate Model" ),
yCol = Col List( "Response",
Data Type( Numeric ),
Min Col( 1 ),
Max Col( 1 )
),
mCol = Col List( "Model",
Data Type( Numeric ),
Min Col( 1 ),
Max Col( 1 )
)
);
If( dlg["Button"] == -1,
Throw( "User cancelled" );
);
Remove From( dlg );
Eval List( dlg );
dt = Current Data Table();
response = yCol[1] << Get As Matrix;
model = mCol[1] << Get As Matrix;
residual = model - response;
sst = Sum( (response - Mean( response ) )^2 );
sse = Sum( residual^2 );
ssm = sst - sse;
r square = ssm / sst;
dt << New Column( "Residual", Values( residual ) );
New Window( "Evaluate Model",
dt << Graph Builder(
Variables( X( mCol[1] ), Y( yCol[1] ) ),
Elements( Points( X, Y, Legend( 3 ) ) ),
Show Control Panel( 0 )
),
dt << Graph Builder(
Variables( X( :Residual ), Y( yCol[1] ) ),
Elements( Points( X, Y, Legend( 3 ) ) ),
Show Control Panel( 0 )
),
Text Box( "R square is " || Char( r square ) )
);
```

Learn it once, use it forever!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Mar 16, 2017 1:52 PM
(2150 views)

You could try Fit Y by X. Put the real data in X, the model data in Y. Fit a line (red triangle). The slope is the RSquared and you can examine the residuals using the other plots.

Best,

M

Best,

M