[R] lars - lasso problem

Martin Wegmann baliola at riseup.net
Fri Jun 13 18:16:08 CEST 2003


hello Berwin, 

thanks for your help, I haven't considered this x-naming problem (pretty 
stupid mistake :-) ) - now it is working.  

cheers to Oz, Martin

On Friday 13 June 2003 13:01, Berwin Turlach wrote:
> G'day Martin,
>
> >>>>> "MW" == Martin Wegmann <baliola at riseup.net> writes:
>
>     MW> I tried to use lars() but neither with my own data nor with
>     MW> the sample data it works. I get in both cases the following
>
>     MW> error prompt:
>     >> data(diabetes)
>     >> par(mfrow=c(2,2))
>     >> attach(diabetes)
>     >> x<-lars(x,y)
>
> Works for me.  But this is not a good style because it creates an
> object with the name "x" in you local working directory.  In
> subsequent calls that "x" will be found before the "x" that is in the
> frame where the diabetes data is attached (I am probably using the
> wrong terminology here).
>
> Better say something like
>        fm <- lars(x,y)
>
>     MW> due to the prompt "requires numeric matrix..." I changed the
> variables to MW> matrix/vector or used different columns but it doesn't
> work either. Probably you created variables called "x" in your working area
> that are found first.  And that variable are not numeric.  Did you try
> "rm(x)" or, more extreme, "rm(list=ls())" before running the lars
> command?
>
>     MW> what does "error in one %*%x mean?
> %*% is the R operator for matrix multiplication.  It requires a
> numeric arguments, either two matrices, or a matrix and a vector,
> or....
> Obviously, the writer of the lars package define a vector/matrix with
> the name one which is multiplied at some point in the code with the
> vector/matrix x.  You get the error because one of the two is not a
> numeric vector/matrix, presumably x.
>
> Hope that helps.
>
> Cheers,
>
>         Berwin
>
> ========================== Full address ============================
> Berwin A Turlach                      Tel.: +61 (8) 9380 3338 (secr)
> School of Mathematics and Statistics        +61 (8) 9380 3383 (self)
> The University of Western Australia   FAX : +61 (8) 9380 1028
> 35 Stirling Highway
> Crawley WA 6009                e-mail: berwin at maths.uwa.edu.au
> Australia                        http://www.maths.uwa.edu.au/~berwin




More information about the R-help mailing list