[R] Problem with 'lars' package

Steve Lianoglou mailinglist.honeypot at gmail.com
Fri Nov 5 22:46:44 CET 2010


On Fri, Nov 5, 2010 at 4:14 PM, Vladimir Subbotin
<subbotinvladimir1 at gmail.com> wrote:
> Hello,
> I have problems with 'lars' package. I found the previous post of the person
> who had the same issue, but the suggested solution in that post did not help
> me.
> I created the matrices:
> ResponseMatrix <- data.frame (GAOdecision=GAOdecision)
> PredictorsMatrix <- data.frame (WeaponvsNon = WeaponvsNon, ProductvsService
> = ProductvsService, KDuration = KDuration, BusinessSize = BusinessSize,
> Bidders = Bidders, Staging = Staging, Criteria = Criteria, KPricing =
> KPricing, Political = Political)
> and then
> output <- lars(PredictorsMatrix, ResponseMatrix)
> *Error in one %*% x : requires numeric/complex matrix/vector arguments*

This is likely talking about variables in the function -- for
instance, not that the first parameter in the function is named 'x'.

Also, your ResponeMatrix and PredictorsMatrix should be of type
*matrix* not data.frame ... you can try to convert it with
as.matrix(ResponseMatrix). You should then ensure that all values in
your response and predictors matrix are numeric, ie:
all(is.numeric(ResponseMatrix)), etc ... also check for odd values
like NA, NaN or Inf.

Lastly, consider using the glmnet package instead of lars. It provides
a superset of the functionality from lars, and its "core" is written
in fortran, so will likely be much faster and deal with larger
problems. It's also more actively maintained (note a new version of
glmnet was just released this week).


Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact

More information about the R-help mailing list