Maximize nonlinear regression function in R
问题 Given a linear model obtained from the function call reg = lm(...) , how can you find the coefficients that maximize the obtained regression function? I'm aware of the function optim(...) , but it requires a function as an input. I haven't figured out how to extract this from the regression model. It should be noted that I'm using non-linear terms in my regression analysis (squared variables, to be precise). In other words, by regression function looks like y_hat = kx_11*x_1+kx_12*x_1^2 + kx