'How can plot given an equation with four variables in R?

I am trying to 4D plot the following equation in R.

y = 14.446 + 0.75a - 1b + 1.1c - 0.7ab + 1.2ac - 2.35bc + 0.05abc

I am wanting it to plot from -1 to 1 for a,b, and c. The goal is to you the plot to see what combination of a, b, and c will lead to the smallest y values.

I appreciate any help. Thank you.



Solution 1:[1]

For a quick look, you can plot the function varying one parameter at a time:

# e.g. as a function of a:
b <- 1
c <- 1
curve(14.446 + 0.75*x - 1*b + 1.1*c - 0.7*x*b + 1.2*x*c - 2.35*b*c + 0.05*x*b*c,
      from = -1, to = 1)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sara