Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
OLS Estimation with 2 variables in Matlab

Subject: OLS Estimation with 2 variables in Matlab

From: Julia Groner

Date: 4 Dec, 2005 17:26:26

Message: 1 of 2

Hello everyone!

I'm pretty new to MatLab and need some help running a simple OLS
regession in Matlab. I downloaded a toolbox for econometrics from the
internet that allows for an OLS regression, but unfortunately, i can
only enter one explanatory variable and it will not return the
intercept coefficient either?

Has anyone got a hint for me, how i can get around this problem? I
introduced a vector of 1's for the intercept and tried the command
"regression", but it doesn't work either.

This probably sounds trivial to you guys, but I am slightly stuck.
:o)

Thanx very much for your help!

Julia

Subject: OLS Estimation with 2 variables in Matlab

From: Dick Startz

Date: 4 Dec, 2005 15:15:53

Message: 2 of 2

On Sun, 4 Dec 2005 17:26:26 -0500, "Julia Groner" <j.groner@gmail.com>
wrote:

>Hello everyone!
>
>I'm pretty new to MatLab and need some help running a simple OLS
>regession in Matlab. I downloaded a toolbox for econometrics from the
>internet that allows for an OLS regression, but unfortunately, i can
>only enter one explanatory variable and it will not return the
>intercept coefficient either?
>
>Has anyone got a hint for me, how i can get around this problem? I
>introduced a vector of 1's for the intercept and tried the command
>"regression", but it doesn't work either.
>
>This probably sounds trivial to you guys, but I am slightly stuck.
>:o)
>
>Thanx very much for your help!
>
>Julia

Getting the coefficients is easy, as the backslash operator does a
least squares regression. If you want to regress y on X1, X2 and a
constant try

[X1 X2 ones(length(y)]\y

-Dick Startz
----------------------
Richard Startz RichardStartz@comcast.net
Lundberg Startz Associates

Tags for this Thread

No tags are associated with this thread.

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.

Contact us