mars.to.earth {earth}R Documentation

Convert a 'mars' to an 'earth' object

Description

Convert a ‘mars’ object to an ‘earth’ object

Usage

mars.to.earth(object)

Arguments

object A ‘mars’ object, created using mars in the mda package.

Value

The value is the same as that returned by earth but with skeletal versions of rss.per.subset, gcv.per.subset, and prune.terms.

You can fully initialise these components by calling update.earth after mars.to.earth, but if you do this selected.terms may change. However with pmethod="backward" a change is unlikely — selected.terms would change only if GCVs are so close that numerical errors have an effect.

Note

Perhaps the most notable difference between earth and mars objects is that earth returns bx in $bx, while mars returns bx in $x.

For details of other differences between earth and mars objects, see the comments in the source code of mars.to.earth().

See Also

earth, mars

Examples

## Not run: 
# The example is not run with example("mars.to.earth") because that would
# require making the earth package dependent on the mda package.

library(mda)
a <- mars(trees[,-3], trees[,3])
a <- mars.to.earth(a)
summary(a, digits = 2) # the standard earth functions can now be used

# yields (note the reconstructed call):
#    Call:
#    earth(x = trees[, -3], y = trees[, 3])
#
#    Expression:
#      20
#      +  5.4 * pmax(0,  Girth -     12)
#      -  2.6 * pmax(0,     12 -  Girth)
#      + 0.72 * pmax(0, Height -     76)
#
#    Number of cases: 31
#    Selected 4 of 5 terms, and 2 of 2 predictors
#    Number of terms at each degree of interaction: 1 3 (additive model)
#    GCV: 13     RSS: 251     GRSq: 0.95     RSq: 0.97

## End(Not run)

[Package earth version 1.0-8 Index]