[R] lm() function

Cleber Nogueira Borges klebyn at yahoo.com.br
Fri May 30 01:43:07 CEST 2008


>>> 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...
in mixture modelling is very common make this: (exmple)

 > x <- rnorm(10)
 > y <- 1-x
 > resp <- 2*x + 4*y + rnorm(10)
 > mixture <- lm( resp ~ -1+x+y )
 > summary( mixture )

Call:
lm(formula = resp ~ -1 + x + y)

Residuals:
Min 1Q Median 3Q Max
-1.30823 -0.67977 -0.03052 0.65214 1.40058

Coefficients:
Estimate Std. Error t value Pr(>|t|)
x 2.4470 0.3498 6.995 0.000113 ***
y 4.0545 0.3203 12.658 1.43e-06 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.9663 on 8 degrees of freedom
Multiple R-squared: 0.954, Adjusted R-squared: 0.9424
F-statistic: 82.87 on 2 and 8 DF, p-value: 4.496e-06

 >


	
	
		
_______________________________________________________ 

Experimente já e veja as novidades.



More information about the R-help mailing list