4
$\begingroup$

I am trying to fit a nonlinear regression model in R using nls(). I have a form of the equation I want to fit to:

$$y = (a \times x_{1}^c +b \times x_{2}^d) (x_{3}^e)$$

where the coefficients to be found in regression are a,b,c,d, and e. My data is output from a simulation model where $x_{1}$, $x_{2}$, and $x_{3}$ are all integers from $0$ to $10$, with the condition that $x_{1} + x_{2} + x_{3} \le 10$. $y$ is also integer valued and ranges from $0$ to roughly $1000$. The objective is to fit these data to a rate function that will be used in a Markov Chain.

When I try to fit this regression model directly using nls(), my nlsResiduals plot looks like this:

nls residuals

I know that autocorrelated residuals are problematic, and that non-normal residuals can also be problematic. How can I fix this problem? I was thinking of using transforms on the data like

$$\log(y) = \log((a \times x_{1}^c +b \times x_{2}^d) (x_{3}^e))$$

or

$$y^{1/n} = ((a \times x_{1}^c +b \times x_{2}^d) (x_{3}^e))^{1/n}$$ where $n > 1$. I've noticed if $n$ increases, my autocorrelation graph and QQ-plot look "better" (i.e., more scattered and more normal, respectively).

Both of these seem to correct a lot (but not all) of the autocorrelated residuals, and help to make the residuals more normally distributed. Am I on the right track here, or am I committing some cardinal sin in statistics? Once I settle on a transformation, how can I tell which is best?

Any help, suggestions, or comments are very appreciated.

$\endgroup$
4
  • 5
    $\begingroup$ Usually, when people use transformations to improve characteristics of the fit (like the normality of the residuals), the transformation is applied just to the LHS / $y$. Of course you can transform the RHS too, but that typically addresses different issues, such as curvature in the data that the model is missing. However, your non-linear model ought to be flexible enough to capture whatever curvature is there, I would think. Note also, that there is no reason the same transformation needs to be used on both sides. $\endgroup$ Commented Sep 8, 2013 at 23:45
  • 3
    $\begingroup$ An alternative is to revisit the model. Do you perhaps need another additive term, say $(a x_1^C + b x_2^d) x_3^e + f$ ? The transformation you have maps $(0,0,0)$ to 0; but you say that $y$ is at least 10... $\endgroup$
    – petrelharp
    Commented Sep 9, 2013 at 9:12
  • $\begingroup$ Sorry, that's a typo. It should range starting from 0. $\endgroup$ Commented Sep 9, 2013 at 17:54
  • $\begingroup$ I guess my other question is, given my nlsResiduals plot looks the way it does, should I be using a transformation? I'm not interested in confidence intervals (which, I think normally dist'd residuals are required for), but just the coefficients for the equation to use as they are. $\endgroup$ Commented Sep 9, 2013 at 18:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.