a <- earth(Volume ~ ., data = trees)
cat(format(a))
# yields:
# 26.6
# + 6.05 * pmax(0, Girth - 13.7)
# - 3.2 * pmax(0, 13.7 - Girth)
# + 0.608 * pmax(0, Height - 75)
cat(format(a, use.names = FALSE, add.labels = TRUE))
# yields:
# 26.6 # 1
# + 6.05 * pmax(0, x[,1] - 13.7) # 2
# - 3.2 * pmax(0, 13.7 - x[,1]) # 3
# + 0.608 * pmax(0, x[,2] - 75) # 4
Run the code above in your browser using DataLab