a <- earth(Volume ~ ., data = trees)
cat(format(a))
# yields:
# 23.2
# + 5.75 * h(Girth-12.9)
# - 2.87 * h(12.9-Girth)
# + 0.718 * h(Height-76)
cat(format(a, style="pmax")) # default formatting style prior to earth version 1.4
# yields:
# 23.2
# + 5.75 * pmax(0, Girth - 12.9)
# - 2.87 * pmax(0, 12.9 - Girth)
# + 0.718 * pmax(0, Height - 76)
cat(format(a, style="bf"))
# yields:
# 23.2
# + 5.75 * bf1
# - 2.87 * bf2
# + 0.718 * bf3
#
# bf1 h(Girth-12.9)
# bf2 h(12.9-Girth)
# bf3 h(Height-76)
Run the code above in your browser using DataLab