Skip to content
Prev 245838 / 398506 Next

Question about mars() -function

On Dec 26, 2010, at 17:54 , Tiina Hakanen wrote:

            
This isn't really to do with MARS as such. You have two equivalent linear models, one with and one without an intercept (i.e., the first column m$x1 is the constant 1). R computes the R^2 so that it is consistent with the overall F test, which you can see has three numerator DF in the marsmodel, but only two in the corresponding linear model. Put differently, the null model is zero in one case and a constant in the other. This sometimes catches people out, but without such a convention, no-intercept models could get negative R^2.

Pragmatically, if you are sure that the marsmodel will always contain the intercept-only model, does lm(data[,1]~m$x) not provide the desired R^2, with a warning that one parameter is aliased?