[R] Alternatives to linear regression with multiple variables
Liaw, Andy
andy_liaw at merck.com
Mon Feb 22 18:50:39 CET 2010
You can try the locfit package, which I believe can handle up to 5
variables. E.g.,
R> library(locfit)
Loading required package: akima
Loading required package: lattice
locfit 1.5-6 2010-01-20
R> x <- matrix(runif(1000 * 3), 1000, 3)
R> y <- rnorm(1000)
R> mydata <- data.frame(x, y)
R> str(mydata)
'data.frame': 1000 obs. of 4 variables:
$ X1: num 0.21 0.769 0.661 0.978 0.15 ...
$ X2: num 0.426 0.132 0.214 0.774 0.472 ...
$ X3: num 0.971 0.659 0.474 0.867 0.479 ...
$ y : num -0.496 -0.636 1.778 -0.876 0.657 ...
R> fit <- locfit(y ~ lf(X1, X2, X3), data=mydata)
R> plot(fit)
Andy
> -----Original Message-----
> From: r-help-bounces at r-project.org
> [mailto:r-help-bounces at r-project.org] On Behalf Of Guy Green
> Sent: Monday, February 22, 2010 7:47 AM
> To: r-help at r-project.org
> Subject: [R] Alternatives to linear regression with multiple variables
>
>
> I wonder if someone can give some pointers on alternatives to linear
> regression (e.g. Loess) when dealing with multiple variables.
>
> Taking any simple table with three variables, you can very
> easily get the
> intercept and coefficients with:
> summary(lm(read_table))
>
> For obvious reasons, the coefficients in a multiple
> regression are quite
> different from what you get if you calculate regressions for
> the single
> variables separately. Alternative approaches such as Loess seem
> straightforward when you have only one variable, and have the
> advantage that
> they can cope even if the relationship is not linear.
>
> My question is: how can you extend a flexible approach like Loess to a
> multi-variable scenario? I assume that any non-parametric calculation
> becomes very resource-intensive very quickly. Can anyone suggest
> alternatives (preferably R-based) that cope with multiple
> variables, even
> when the relationship (linear, etc) is not known in advance?
>
> Thanks,
>
> Guy
> --
> View this message in context:
> http://n4.nabble.com/Alternatives-to-linear-regression-with-mu
> ltiple-variables-tp1564370p1564370.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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