Re: [R] lm() function

From: Peter Dalgaard <p.dalgaard_at_biostat.ku.dk>
Date: Fri, 30 May 2008 06:14:43 +0200

Cleber Nogueira Borges wrote:
>
>>>> 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
>>>
>> may I ask how this may solve the problem?
>> You concatenate the two vectors x1, x2; calculate the sum of it;
>> round it to 12 digits; and then check whether it is equal to 1.
>>
>> Roland
>
>
> ok, sorry for incomplete question...
> this problem smell like mixture modelling... (chemical mixture for
> example)
> this command not solve the problem, but check one condition...
It still doesn't do what you think... all.equal(x1+x2,1) is more like it.

A more general approach is summary(lm(x1~x2)) or just plot (x1~x2) to check for a perfect linear relation, or possibly a constant x1.

-- 
   O__  ---- Peter Dalgaard             ุster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard_at_biostat.ku.dk)              FAX: (+45) 35327907

______________________________________________
R-help_at_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.
Received on Fri 30 May 2008 - 04:20:12 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 30 May 2008 - 04:30:44 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive