Prev: Function for OLS regression with a dummy variable
Next: how to create a smiley face using matlab that will roll across the screen.
From: Chris on 25 Oct 2009 07:09 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!
From: Chris on 25 Oct 2009 08:10 "Chris" <AzizC0rn(a)bluestring.com> wrote in message <hc1bep$1d5$1(a)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)
From: Oleg Komarov on 1 Nov 2009 06:46
"Chris" <AzizC0rn(a)bluestring.com> wrote in message <hc1bke$bvr$1(a)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! Help regstats, stepwise, regress be careful with the constant Oleg |