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
- :
- Fitting models using data in a matrix

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

Fitting models using data in a matrix

Jun 9, 2011 6:29 AM
(1108 views)

When I want to fit a regression model to a data set in script, I'll normally write something like the following:

dt = open("$SAMPLE_DATA/Big Class.jmp");

dt << Fit Model(

Y( :Height ),

Effects( :Weight ),

Personality( Standard Least Squares ),

Run Model

);

This assumes that the data is contained in a data table with columns named as in the example above, but is there a way to fit the same model using just data contained in columns of a matrix, i.e. without needing to turn that matrix into a data table first? If so, what would the syntax be?

Many thanks

dt = open("$SAMPLE_DATA/Big Class.jmp");

dt << Fit Model(

Y( :Height ),

Effects( :Weight ),

Personality( Standard Least Squares ),

Run Model

);

This assumes that the data is contained in a data table with columns named as in the example above, but is there a way to fit the same model using just data contained in columns of a matrix, i.e. without needing to turn that matrix into a data table first? If so, what would the syntax be?

Many thanks

3 REPLIES 3

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

Re: Fitting models using data in a matrix

Hi David:

If it is truly OLS you are interested in:

Best,

-Matt

If it is truly OLS you are interested in:

Best,

-Matt

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

Re: Fitting models using data in a matrix

Perhaps you were thinking something like:

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

Re: Fitting models using data in a matrix

Hi Matt - yes, it's specifically OLS I've got in mind, and I'll probably end up writing the regression calculations out in matrix algebra as you have in you first post if there isn't an easier way. I'd actually been playing around with almost exactly what you suggested in your second post in the hope that I could bypass the need to do it in matrix algebra; but by the look of it that's probably going to be the simplest way - and the algebra's not difficult.

My main motivation for asking is to maximize the speed of the calculations, as I want to perform a large number of them in rapid succession, and don't want to waste time creating and then deleting large numbers of tables if it can be avoided, as I've found in the past that I can often speed things up dramatically by doing as much work as I can in matrix algebra.

Many thanks - it looks as if I'm on the right track, anyway.

My main motivation for asking is to maximize the speed of the calculations, as I want to perform a large number of them in rapid succession, and don't want to waste time creating and then deleting large numbers of tables if it can be avoided, as I've found in the past that I can often speed things up dramatically by doing as much work as I can in matrix algebra.

Many thanks - it looks as if I'm on the right track, anyway.