2
$\begingroup$

I have FX data for USD/SEK and I am trying to use the OLS to build a predictive model to predict the closing price. The closing price is the response variable. The USD/SEK opening price, low price, high price, and volume quantity are predictor variables. Also the technical indicators kama, rsi, atr, adosc, and ht_dcphase are predictor variables. This is a sample of the predictor variables I am working with:

      Open     High      Low  Volume      kama        rsi       atr      adosc  ht_dcphase
0  9.27321  9.27333  9.27157   81.40  9.276249  38.152137  0.001786 -25.165500  -35.239788
1  9.27198  9.27240  9.27050   68.90  9.275957  36.839142  0.001792 -25.530417  -30.358490
2  9.27069  9.27249  9.27069   48.85  9.275611  38.573517  0.001792 -19.213906  -25.987433
3  9.27194  9.27308  9.27141  101.80  9.275340  38.239836  0.001786 -37.188277  -19.531568
4  9.27172  9.27203  9.27118   50.60  9.274849  38.589333  0.001739 -34.910088  -15.758488
5  9.27132  9.27304  9.27132  261.00  9.274593  41.845608  0.001738  20.374718  -11.781446
6  9.27271  9.27315  9.27075   83.20  9.274126  38.173597  0.001771  22.166862   -5.775060
7  9.27109  9.27148  9.27012  153.95  9.273745  37.892721  0.001751  32.410510    0.607573
8  9.27096  9.27346  9.27096  126.25  9.273559  40.953272  0.001788  21.442866    3.377338
9  9.27175  9.27211  9.27008  286.40  9.273358  40.163040  0.001800  51.367879    9.866369

I fitted the OLS model and I ran the Anderson-Darling test and it showed that the data isn't linear and I made a normal probability plot. Residuals Normal Probability Plot

I tried the following methods to make the data linear:

1) I standard score to transform the data and then used the yeo-johnson transformation. I then refitted the model with the transformed data and the residuals still aren't linear Residuals Normal Probability Plot 2) I used the MinMax to transform the data and then used the yeo-johnson transformation. I then refitted the model with the transformed values and the residuals still aren't linear. Residuals Normal Probability Plot

What method should I use to normalize the data to make it linear.

$\endgroup$

2 Answers 2

3
$\begingroup$

First, OLS regression does not require that the variables be normally distributed. It makes assumptions about the residuals.

Second, if those assumptions are violated, my view is that it is better to use a different method rather than to transform the data (e.g. Quantile regression or robust regression).

Third, by including both open and close price as IVs, you will surely have colinearity.

Finally, you seem to have time series data. You should use time series methods.

$\endgroup$
0
3
$\begingroup$

By residuals being linear you mean, it seems, that you would get an approximately linear configuration for points on a normal quantile plot (normal probability plot) of residuals, indicating approximate normality of residuals.

The question omits crucial information (and includes some details that don't help clarify):

  1. What is in your model? Closing price is the response or outcome variable you are trying to predict, but precisely which predictors did you use? How well does that work?

  2. Predicting prices by other prices may or may not make sense if that is what you did, but you need people with expertise in your field to comment.

  3. Taking standard scores itself does nothing to transform a distribution beyond linear scaling, but it is often harmless. Standard scores won't be closer to normal than the original values. What precisely did you do by way of Yeo-Johnson transformation?

  4. MinMax may be the name of some routine, function or command you are using in your unstated software. It's not universal jargon. If it's some variation on (value MINUS minimum) / (maximum MINUS minimum) then, like standard scores, it will do nothing to get data or residuals closer to a normal distribution.

It is thus hard to suggest how to change your model without more information on what it is. Prices sometimes are better analysed on logarithmic scale, but your first plot suggests an approximately symmetric distribution of residuals, which itself is good news.

It may be that a distribution longer-tailed than normal is a better match for your data generation process.

Normal distribution of errors is an ideal condition in regression, but the least important ideal condition of all.

$\endgroup$
5
  • $\begingroup$ 1) I edited the question to explain the response and predictor variables. 2) Predicting prices by other prices.. I am not using different prices to predict the closing price of the USD/SEK data. I am using the opening price of every 5 mins of the USD/SEK. The same follows for the Low and High prices. 3) I am using the yeo-johnson transformation because I am not able to use the box-cox transformation because I have negative values. Also I cannot use the logarithmic transformations because I have issues dividing with zero in the data 4) I use the minmax feature scaling $\endgroup$ May 9, 2020 at 8:32
  • $\begingroup$ From what I understand from what your saying I shouldn't care much about the normal distribution of errors? From my understand is that the yeo-johnson transformation is a way to transform non-normal dependent variables into a normal shape. This is why I am doing the yeo-johnson transformation $\endgroup$ May 9, 2020 at 8:36
  • $\begingroup$ Your question still states that Open Close High are among the predictor variables you have, so I regard that as unclear and confusing. Price as I understand it cannot be zero or negative so I see no reason in principle why logarithmic scale should not be tried. Naturally if you first scale to standard scores then logarithms of standard scores can't be calculated given negative and possibly zero standard scores, so don't do that. Whether logarithmic scale is a good idea in practice is a different question. Most of my questions haven't been answered so I think this remains too unclear. $\endgroup$
    – Nick Cox
    May 9, 2020 at 9:03
  • $\begingroup$ You are confusing normal distribution of residuals with normal distribution of the outcome variable. Transforming the outcome variable may be a good idea to get closer to a linear relationship but normality of outcome is not among the standard ideal conditions for regression. Any good regression or econometrics text (e.g. Wooldridge's introductory text) explains. $\endgroup$
    – Nick Cox
    May 9, 2020 at 9:05
  • $\begingroup$ That should be Open High Low. $\endgroup$
    – Nick Cox
    May 9, 2020 at 10:00

Your Answer

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

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