I am curious how to plot function that is defined something like this:
if(x < 1)
f(x) = x/10 * 1.2
if(x < 3)
f(x) = x/12 * 1.7
...
else
f(x) = x/15 * 2
If the function was simple, say f(x) = x/10 * x/5 , then there would be no problem, and one could use curve() method. However I am not sure what is the best way to deal with more complex functions, like the one above. Any ideas? Bonus points, if ggplot() could be used 🙂
Curve is still a possibility. (And as you read the statistical literature, this formulation shows up as I[x], “I” being for “indicator”.)