[R] R-squared for MARS models
Gavin Simpson
gavin.simpson at ucl.ac.uk
Thu Apr 20 09:31:31 CEST 2006
On Wed, 2006-04-19 at 21:18 +0200, Marco Girardello wrote:
> Hi,
>
> is there an R function which can compute the R-squared
> for a mars model fitted using the mda package?
>
> many thanks in advance
>
> best regards
>
> Marco Girardello
Julian Faraway's "Extending the Linear Model with R" Chapman & Hall/CRC
(page 248)has a small section on MARS and compares the MARS fit with
other methods by using the MARS basis functions in a linear model to get
an R^2:
# page 248 example
library(faraway)
library(mda)
data(ozone)
a <- mars(ozone[,-1], ozone[,])
(a.summ <- summary(lm(ozone[,1] ~ a$x-1)))
a.summ$r.squared
HTH
G
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
*Note new Address and Fax and Telephone numbers from 10th April 2006*
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [t] +44 (0)20 7679 0522
ECRC [f] +44 (0)20 7679 0565
UCL Department of Geography
Pearson Building [e] gavin.simpsonATNOSPAMucl.ac.uk
Gower Street
London, UK [w] http://www.ucl.ac.uk/~ucfagls/cv/
WC1E 6BT [w] http://www.ucl.ac.uk/~ucfagls/
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
More information about the R-help
mailing list