Thread Subject: Function for OLS regression with a dummy variable

Subject: Function for OLS regression with a dummy variable

From: Chris

Date: 25 Oct, 2009 11:06:01

Message: 1 of 2

Dear All,

I want to estimate a simple linear regression (get parameter and error estimates) that includes a dummy variable (say Dv) taking values of 0 and 1, of the following form:

y=constant+a*x+f*Dv+errors

Note that the variable Dv is predetermined depending on the time that a break occurs (ToB)
e.g. Dv(1:ToB,1)=0;
Dv(ToB:length(x),1)=1;

where say ToB=100 and length(x)=800


The question is which function should I use to get the OLS parameter estimates (constant, s,f,errors)?

Thank you very much for your time and help!

Subject: Function for OLS regression with a dummy variable

From: Chris

Date: 25 Oct, 2009 12:10:02

Message: 2 of 2

"Chris" <AzizC0rn@bluestring.com> wrote in message <hc1bep$1d5$1@fred.mathworks.com>...
> Dear All,
>
> I want to estimate a simple linear regression (get parameter and error estimates) that includes a dummy variable (say Dv) taking values of 0 and 1, of the following form:
>
> y=constant+a*x+f*Dv+errors
>
> Note that the variable Dv is predetermined depending on the time that a break occurs (ToB)
> e.g. Dv(1:ToB,1)=0;
> Dv(ToB:length(x),1)=1;
>
> where say ToB=100 and length(x)=800
>
>
> The question is which function should I use to get the OLS parameter estimates (constant, s,f,errors)?
>
> Thank you very much for your time and help!

I think I found it (thought that X must be a vector):
X=[x Dv];
[b,bint,r,rint] = regress(y,X)

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
linear Chris 25 Oct, 2009 07:09:03
dummy variable Chris 25 Oct, 2009 07:09:03
ols regression Chris 25 Oct, 2009 07:09:02
rssFeed for this Thread

Contact us at files@mathworks.com