earth.mod <- earth(Volume ~ ., data = trees)
cat(format(earth.mod))
# yields:
# 29.0
# - 3.42 * h(14.2-Girth)
# + 6.23 * h(Girth-14.2)
# + 0.581 * h(Height-75)
cat(format(earth.mod, style="pmax"))
# yields:
# 29.0
# - 3.42 * pmax(0, 14.2 - Girth)
# + 6.23 * pmax(0, Girth - 14.2)
# + 0.581 * pmax(0, Height - 75)
cat(format(earth.mod, style="C"))
# yields (note zero based indexing):
# 29.0
# - 3.42 * max(0, 14.2 - x[0])
# + 6.23 * max(0, x[0] - 14.2)
# + 0.581 * max(0, x[1] - 75)
cat(format(earth.mod, style="bf"))
# yields:
# 29.0
# - 3.42 * bf1
# + 6.23 * bf2
# + 0.581 * bf3
#
# bf1 h(14.2-Girth)
# bf2 h(Girth-14.2)
# bf3 h(Height-75)
Run the code above in your browser using DataLab