[R] locfit: max number of predictors?

Liaw, Andy andy_liaw at merck.com
Thu Feb 25 18:19:41 CET 2010

Well, I should think there's an obvious (if not elegant) way to test it:

n <- 5e3
m <- 20
x <- matrix(runif(n * m), nrow=n)
y <- rnorm(n)

fit <- locfit.raw(x[, 1:10], y)

The code above took a while on my laptop, and ended up giving some error
I don't understand.  Not sure if the error was caused by insufficient
sample size, or some inherent limitation.  At least it didn't choke on
five variables.  However, if all 20 columns of x is used, locfit.raw()
will choke because it can't compute the dimension of some variable that
it needs to allocate memory for.

I had vague recollection of reading that "5" is the limit somewhere.
Unfortunately my copy of Local Regression and Likelihood has been MIA
for a few years, so I can't check there.  In any case it doesn't seem
like the number of data points and/or computing power are bigger issue.


> -----Original Message-----
> From: r-help-bounces at r-project.org 
> [mailto:r-help-bounces at r-project.org] On Behalf Of Keith Jewell
> Sent: Thursday, February 25, 2010 4:11 AM
> To: r-help at stat.math.ethz.ch
> Subject: [R] locfit: max number of predictors?
> Hi All,
> In another thread Andy Liaw, who CRAN lists as locfit 
> maintainer; said:
> <quote>
> From: "Liaw, Andy" <andy_liaw at merck.com>
> To: "Guy Green" <guygreen at netvigator.com>; <r-help at r-project.org>
> Subject: Re: Alternatives to linear regression with multiple variables
> Date: 22 February 2010 17:50
> You can try the locfit package, which I believe can handle up to 5
> variables.  E.g.,
> </quote>
> Looking in the locfit documentation (e.g. 
> http://www.stats.bris.ac.uk/R/web/packages/locfit/locfit.pdf) 
> I can't see an 
> upper limit on the number of predictors; if it is 5 I'm 
> getting close in one 
> of my applications.
> Can anyone confirm or deny the existence of a 'crisp' upper 
> limit on the 
> number of predictors in locfit?
> If it is 5, or thereabouts, can anyone suggest an alternative 
> which can 
> handle a few more? (I'm using it for multidimensional interpolation).
> Best regards,
> Keith Jewell
> ______________________________________________
> 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.
Notice:  This e-mail message, together with any attachme...{{dropped:10}}

More information about the R-help mailing list