[R] Intercept in model formulae.

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Wed Sep 11 15:21:27 CEST 2002


"Pfaff, Bernhard" <Bernhard.Pfaff at drkw.com> writes:

> dealing more generally with deterministic structural shiftsmore in the
> context of Classical Linear Regressions, you can define suitable dummy
> variables and multiply them with the regressors (all or a subset). 'test1'
> contains two separate slope coefficients, whereas in 'test2' the additional
> increment in the second subperiod is estimated, hence you have to sum the
> two estimates to get the overall effect for the second subperiod.  
> 
> x <- 1:20
> y <- c(1:10,seq(10.5,15,0.5))
> dum1 <- c(rep(1,10),rep(0,10))
> dum2 <- c(rep(0,10),rep(1,10))
> reg1 <- x*dum1
> reg2 <- x*dum2
> test1 <- lm(y~-1+reg1+reg2)
> test2 <- lm(y~-1+x+reg2)
> summary(test)

Maybe my brain is just getting boiled in here, but I don't think these
correspond to a continuous model, but one that is pieced together from
two lines that both go through the origin.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list