Thread Subject: fitted values

Subject: fitted values

From: Janis Weir

Date: 30 Nov, 2009 16:54:08

Message: 1 of 6

Command for printing out the fitted values of a basic OLS regression?

Subject: fitted values

From: Wayne King

Date: 30 Nov, 2009 17:05:20

Message: 2 of 6

"Janis Weir" <weij@bankofcanada.ca> wrote in message <hf0tbg$dju$1@fred.mathworks.com>...
> Command for printing out the fitted values of a basic OLS regression?

You have the statistics toolbox, see

>>doc regress

Hope that helps,
Wayne

Subject: fitted values

From: Janis Weir

Date: 30 Nov, 2009 17:25:23

Message: 3 of 6

"Wayne King" <wmkingty@gmail.com> wrote in message <hf0u0g$p9b$1@fred.mathworks.com>...
> "Janis Weir" <weij@bankofcanada.ca> wrote in message <hf0tbg$dju$1@fred.mathworks.com>...
> > Command for printing out the fitted values of a basic OLS regression?
>
> You have the statistics toolbox, see
>
> >>doc regress
>
> Hope that helps,
> Wayne

I see the regress command, but not the argument to have matlab display the fitted values?

Subject: fitted values

From: Richard Willey

Date: 30 Nov, 2009 18:25:59

Message: 4 of 6

Hi Janis



If you look at the documentation section for regress in Statistics Toolbox,
you'll find the following example code



% Load data on cars; identify weight and horsepower as predictors, mileage
as the response:



load carsmall

x1 = Weight;

x2 = Horsepower; % Contains NaN data

y = MPG;



% Compute regression coefficients for a linear model with an interaction
term:



X = [ones(size(x1)) x1 x2 x1.*x2];

b = regress(y,X) % Removes NaN data

b =

  60.7104

  -0.0102

  -0.1882

   0.0000





The default output from the regress command is a matrix of coefficients.



Regards,



Richard




"Janis Weir" <weij@bankofcanada.ca> wrote in message
news:hf0tbg$dju$1@fred.mathworks.com...
> Command for printing out the fitted values of a basic OLS regression?

Subject: fitted values

From: Janis Weir

Date: 30 Nov, 2009 19:27:17

Message: 5 of 6

"Richard Willey" <rwilley@mathworks.com> wrote in message <hf12nn$k2m$1@fred.mathworks.com>...
> Hi Janis
>
>
>
> If you look at the documentation section for regress in Statistics Toolbox,
> you'll find the following example code
>
>
>
> % Load data on cars; identify weight and horsepower as predictors, mileage
> as the response:
>
>
>
> load carsmall
>
> x1 = Weight;
>
> x2 = Horsepower; % Contains NaN data
>
> y = MPG;
>
>
>
> % Compute regression coefficients for a linear model with an interaction
> term:
>
>
>
> X = [ones(size(x1)) x1 x2 x1.*x2];
>
> b = regress(y,X) % Removes NaN data
>
> b =
>
> 60.7104
>
> -0.0102
>
> -0.1882
>
> 0.0000
>
>
>
>
>
> The default output from the regress command is a matrix of coefficients.
>
>
>
> Regards,
>
>
>
> Richard
>
>
>
>
> "Janis Weir" <weij@bankofcanada.ca> wrote in message
> news:hf0tbg$dju$1@fred.mathworks.com...
> > Command for printing out the fitted values of a basic OLS regression?
> I'm using the result=ols(y,x) command. I assume that the result.yhat command prints the same estimate coefficients?

Subject: fitted values

From: Richard Willey

Date: 30 Nov, 2009 20:19:03

Message: 6 of 6

>> "Janis Weir" <weij@bankofcanada.ca> wrote in message
>> news:hf0tbg$dju$1@fred.mathworks.com...
>> > Command for printing out the fitted values of a basic OLS regression?
>> I'm using the result=ols(y,x) command. I assume that the result.yhat
>> command prints the same estimate coefficients?


Hi Janis


We (The MathWorks) don't have a command named OLS.



This is only a guess, however, I'm assuming that one of your colleagues at
the Bank of Canada has designed their own custom regression function.
(Alternatively, I know that there is a file exchange submission named OLS,
however, this is performing Orthogonal Least-Squares rather than Ordinary
Least-Squares)



You should have a file names "ols.m" in one of your directories. If you
open this up in the MATLAB editor you might be able to find out whats going
on (with luck, the individual who wrote the function might also have
provided some documentation and/or examples)



I'm not sure what result.yhat will return. This depends completely on how
the function was written.



regards,



Richard

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
fitted values Leslie Wear 30 Nov, 2009 11:59:06
rssFeed for this Thread

Contact us at files@mathworks.com