1

I have to get a regression model for a dataset, and it seems that the best fit is a log-linear model, so that I simply applied the least squares on the trasformed response vector.

$ log(\hat{Y}) = f(X) = \hat\beta_0 + \bf{\hat\beta}^TX$

This means that the values $\hat{z}_i$ I predict from the test set through my model will be the natural logarithms of the target values.

$\hat{z}_i =log(\hat{y}_i)$

Now, how am I supposed to compute the mean squared error and the $R^2$?

Is it correct to consider $MSE = \frac1n{\sum{(y_i - \hat{y}_i)^2}} = \frac1n{\sum{(y_i - e^{\hat{z}_i})^2}}$

or $MSE = exp(\frac1n\sum{(log(y_i)-\hat{z}_i)^2})$ ?

Same question for the $R^2$.

Thanks

Möbius
  • 25
  • 3
  • Do you mean that you have a log transformed outcome or are you analyzing categorical data? [See here](https://stats.stackexchange.com/questions/86720/log-linear-regression-vs-logistic-regression/86722#86722) If the first, then this is not a log-linear model. – AdamO Jun 29 '17 at 16:13
  • It seems that some people do not agree on what a log-linear model is. Anyway, the way we call what I am trying to do is not that important , the link you provided did not really help me with my problem. I am trying to understand how to compute the error on the prediction of a log-transformed outcome, there are no categorical data. – Möbius Jun 29 '17 at 16:35

0 Answers0