Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: how to get the detailed values from a linear model class?
Replies: 2   Last Post: Mar 6, 2013 1:26 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Alan Weiss

Posts: 1,241
Registered: 11/27/08
Re: how to get the detailed values from a linear model class?
Posted: Mar 6, 2013 7:45 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 3/5/2013 4:00 PM, James Anderson wrote:
> I am using the example on the mathworks website:
>
> http://www.mathworks.com/help/stats/linearmodel.disp.html
>
> X = randn(100,5);
> y = X*[1;2;3;4;5] + 6 + randn(100,1);
> mdl = LinearModel.fit(X,y);
>
> one silly question is that how to get the values of those model
> details from mdl? I can easily see them, but not sure how to output
> them or assign to a variable in matlab.
> Thanks,
>
> -James


Not a silly question at all! To get the formula, enter
mdl.Formula

To get the coefficients, enter
mdl.Coefficients

To see what else is lurking in the model, double-click it in the
Workspace browser, or look at the documentation of the class:
http://www.mathworks.com/help/stats/linearmodelclass.html

Alan Weiss
MATLAB mathematical toolbox documentation



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.