hi, my linear model is y=c+a*x1+b*x2 i tried to found a, c, b by the use of: mymodel<-lm(y~1+x1+x2) where y, x1, x2 are 3 vectors with the same length the result is a=NA.so i want to know where is the problem. -- View this message in context: nabble.com/lm()-function-tp17546079p17546079.html Sent from the R help mailing list archive at Nabble.com.
Dear Hanen, You don't need "1" in your R code. Try this: # Model mymodel<-lm(y~x1+x2) # Coefficients summary(mymodel) See also ?lm. Thanks, Jorge On Thu, May 29, 2008 at 5:15 PM, hanen <hanen.mastouri@yahoo.fr> wrote:> > hi, > > > my linear model is y=c+a*x1+b*x2 i tried to found a, c, b by the use of: > > mymodel<-lm(y~1+x1+x2) where y, x1, x2 are 3 vectors with the same length > > the result is a=NA.so i want to know where is the problem. > -- > View this message in context: > nabble.com/lm()-function-tp17546079p17546079.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@r-project.org mailing list > stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]
hanen wrote:> hi, > my linear model is y=c+a*x1+b*x2 i tried to found a, c, b by the use of: > mymodel<-lm(y~1+x1+x2) where y, x1, x2 are 3 vectors with the same length > the result is a=NA.so i want to know where is the problem. >It's the sum of x1 and x2 equal to one? run the command: round( sum( c(x1,x2) ),12)==1 cleber _______________________________________________________ Experimente j? e veja as novidades.