[R] formula and lm

Spencer Graves spencer.graves at pdf.com
Thu Jul 15 22:02:00 CEST 2004


It wants to compute a*x given a and x, and then use ordinarly least 
squares to estimate b0 and b1 in y = b0 + b1*I(a*x).  If that is what 
you intend, you must supply a.  If you want to estimate a, e.g., with no 
constant, use   y~x-1.  Does this answer the question?  hope this 
helps.  spencer graves

solares at unsl.edu.ar wrote:

>Hi, don' t understand why the function fomula have this error, i enclose
>the parameter "a" with the function I()
>Thank Ruben
> x<-1:5
>y<-c(  2  ,4 , 6 , 8 ,11)
>formu<-y~I(a*x)
>form<-formula(formu)
>dummy<-data.frame(x=x,y=y)
>fm<-lm(form,data=dummy)
>Error in unique(c("AsIs", oldClass(x))) : Object "a" not found
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>  
>




More information about the R-help mailing list