On Tue, 2007-11-20 at 16:39 +0100, Irene Mantzouni wrote:
> Hi all!
>  
> Is it possible to model a multiple regression in which the response becomes 
> zero when one of the two covariates is zero?  
> lm(y~ x1+x2) and y=0 if x1=0. 
> However, when x1=0, y=x2+1(intercept). 
> Does this mean I cannot have a second covariate and intercept or should I 
> eliminate only the intercept?
>  
> thank you!

Well, 

If y=x2+1 as same y-1=x2
So you can use lm(y-1~x2-1)

Look this example

set.seed(123)
y<-rnorm(100,sd=2)
x2<-rpois(100,25)
lm(y-1~x2-1)
Call:
lm(formula = y - 1 ~ x2 - 1)

Coefficients:
      x2  
-0.03041 

Your regression is y-1=-0.03041*x2 or y=1-0.03041*x2



-- 
Bernardo Rangel Tura, M.D,MPH,Ph.D
National Institute of Cardiology
Brazil

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to