0
$\begingroup$

In the first step of modeling a regression equation I came up with the following model:

$T_c = 26.73 + 0.042{\rm Sc} + 0.247{\rm Lc} - 14.709{\rm Lf} + 1.41{\rm Lu} - 0.214{\rm Fc} + 0.041{\rm Ad} - 64.308{\rm Sr} - 20.341{\rm Rc}$

Analyzing the residuals it is obviously noticed it does not follow a normal distribution; the relationship between the response variable and predictor is also found to be non-linear. After the attempt of some transformation in both predictors and response variable, and also stepwise procedures (to minimize the number of variables), I came up with the following model:

$T_c^{1.5}= -9.868 + 1.845\ln⁡({\rm Sc}) + 10.23\sqrt{{\rm Lu}} + 6.866 \times 10^{-5} {\rm Ad}^{2.5} + 7.772 \times 10^{-3} {\rm R_c}^{-4.47}$

I am using the method of least square to estimate coefficients and parametric statistic tests based on normality assumptions to test the performance of the model.

  1. My question is how the residual must be calculated and analysed: I am using R language and using function lm, it returns the residual as residual = $Tc^{1.5}$ predicted - $T_c^{1.5}$ observed. However, I feel the residual should be: residual = original $T_c$ - the result of the right side of the above equation to the power of 2/3. Could you shed a light on this please? Am I missing some simple theory on the model that I am not being able to visualize?

  2. The same question is valid to r squared: which one should I choose to calculate r squared, the result of the right side of the above equation to the power of 2/3 (as the predicted variable) or $T_c$ predicted, that is, $T_c^{1.5}$?

$\endgroup$
2
$\begingroup$

If you transformed $T_c$ before fitting the model (e.g. with I(T^1.5) ~ .), then the model was fitted by minimizing the sum of squared $\widehat{(T^{3/2}_c)} - (T^{3/2}_c)^{obs}$ terms.

That is, the error in the model is defined as $X'\beta - y^{obs}$, and your estimated coefficients $\widehat{\beta}$ are obtained by minimizing the sum of squared errors. The fact that $y$ happens to be a transformation of some other variable is irrelevant for this process. Therefore these are the correct residuals for computing $R^2$ with respect to the transformed outcome. Moreover, lm deliberately does not keep track of the transformations you apply to any of your variables.

Now, if you're interested in the predictive performance of the model with respect to the original outcome, you are free to compute residuals. But now your model is nonlinear, so $R^2$ could lack its convenient properties. $R^2_{adjusted}$ is probably also invalid. But there's no reason you can't use it to measure model performance.

$\endgroup$
  • $\begingroup$ Ok ssdecontrol. thank you for your answer and some follow up questions: When you say that "lm deliberately does not keep track of the transformations[...]", do you mean that I should transform my dataset before fitting the model instead of applying the transformation dynamically in the formula field in lm function? 2. Just to make sure I got your last point, the equation is Tc=(−9.868+1.845ln(Sc)+10.23Lu−−−√+6.866×10−5Ad^2.5+7.772×10−3Rc^−4.47)^(2/3) would not be linear because the coefficients is being implicitly altered by the power 2/3 ? $\endgroup$ – Alan Alves Aug 18 '14 at 11:33
  • $\begingroup$ No, I actually mean that it doesn't matter where you apply your transformation because it's the same to lm either way. The actual functions that do the heavy lifting inside lm get passed the same matrix in both cases. And about the nonlinearity, yes. But to be precise, it's not because the coefficients are being altered, but because the linear combination of the regressors is being altered. That is, the model is no longer linear with respect to the regressors. $\endgroup$ – shadowtalker Aug 18 '14 at 13:39
  • $\begingroup$ @user3526125 By the way, take a look at the formatting help on this site. It's much more readable to use fixed-width code formatting and $\LaTeX^{math}_{formatting}$ for stuff like this. $\endgroup$ – shadowtalker Aug 19 '14 at 16:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.