An earth object.
This is the only required argument.
style
Formatting style. One of "h" (default) more compact "pmax" for those who prefer it and for compatibility with old versions of earth "max" is the same as "pmax" but prints max rather than pmax "C" C style expression with zero based indexing "bf" basis function format
decomp
One of "anova" (default) order the terms using the "anova decomposition",
i.e., in increasing order of interaction "none" order the terms as created during the earth forward pass.
digits
Number of significant digits.
The default is getOption(digits).
use.names
One of TRUE (default), use variable names if available. FALSE use names of the form x[,1].
colon.char
Change colons in the returned string to colon.char.
Default is ":" (no change).
Specifying colon.char="*" can be useful in some contexts to change
names of the form x1:x2 to x1*x2.
...
Unused, but provided for generic/method consistency.
Value
A character representation of the earth model.
If there are multiple responses, format.earth will return multiple strings.
If there are embedded GLM model(s), the strings for the GLM model(s)
come after the strings for the standard earth model(s).
Note
The FAQ section in the package vignette gives precise details of the
"anova" ordering.
Using format.earth, perhaps after hand editing the returned string,
you can create an alternative to predict.earth.
For example:
Note that with pmax the R expression generated by
format.earth can handle multiple cases.
Thus the expression is consistent with the way predict
functions usually work in R — we can give predict multiple
cases (i.e., multiple rows in the input matrix) and it will return a
vector of predicted values.
The earth package also provides a function format.lm.
It has arguments as follows format.lm(x, digits=getOption("digits"), use.names=TRUE, colon.char=":")
(Strictly speaking, format.lm doesn't belong in the earth package.) Example: