From a bootstrapping model I have 1000 sets of coefficients for this regression model:
y = b0 + b1x + b2(x^2)
What is the function call to plot a quadratic line if I already have the coefficients? I.E. I do not want to "fit" a linear model to my data.
I tried adding lines via a for loop to my ggplot object:
for (i in 1:1000) {
reg_line <- stat_function(fun=function(x) quad$coefficients[1] +
quad$coefficients[i,2]*x + quad$coefficients[i,3]*(x**2))
reg_lines <- reg_lines + reg_line}
That didn't work - it seems to only add the last line in the loop.
The reason I want to add 1000 regression lines to my plot is because it is for a homework problem - I am well aware this is not a common use case.