# [R-sig-finance] correlation between two stock market indices

Pfaff, Bernhard Bernhard.Pfaff at drkw.com
Mon Aug 30 11:08:43 CEST 2004

```>
> Dear finance professionals
>
> As I was asked by a friend, whether we can compute the correlation
> between two stock market indices (e.g. NASDAQ index and Dow Jones
> index), and I am unfortunately NOT an expert in finance:

Hello Christoph,

you can almost always compute correlations, if these calculations make sense
and are meaningful is a different matter :-)

>
> (1) What model would you recommend for this kind of question?
>
> something like:
>
> library(ts)
> arima(x, order=???, xreg=y)

sure, you can do this and choose the appropriate order as it is outlined by
Box-Jenkins (i.e. check the acf and pacf of the residuals combined with
diagnostic tests for serial uncorrelatedness). Most likely you want/have to
work with differenced data, due to the *trending* character of the ts in
question. The snag is that level information is lost. Hence, you might want
to specify an ECM / VECM and prior to this check the order of integration of
the series involved. Relevant packages to accomplish this would be ts,
tseries, dse and urca; to my knowledge (check
http://www.mayin.org/ajayshah/KB/R/R_for_economists.html for an overview).

>
> library(nlme)
> gls(x~y,correlation=corARMA(p=?,q=?))
>
> what would you recommend, and what about the "?" :)

this would apply if the *error term* is not nicely behaved and would follow
as a second step, hence after checking the residuals from a simple lm() or
arima(), as is described from ?gls

Description:

This function fits a linear model using generalized least squares.
The errors are allowed to be correlated and/or have unequal
variances.

As a side note, in econometrics it is common notation that the response is
named 'y' and the predictor 'x' and not vice versa.

>
> (2) Furthermore, searching the web, I found, that (sorry, you experts
> certainly know this, but I have no experience with financial data),
> usually the time series are uncorrelated, but show strong "ARCH
> effects", ie., are not independent.

ARCH refers to the behaviour of the variance of the error term
(autoregressive conditional heteroskedasticity). Again, check the residuals
first, if ARCH is prevailent and only then estimate an ARCH, GARCH etc. type
of model. Note, uncorrelatedness and independence are only equivalent in
case of normality. The former does not imply the latter, only if the the
series are normally distributed. But if two series are independent then
these series are also uncorrelated.

A last side note, ask yourself what the model's aim is. What should the
model explain? What's it purpose? After having answered these questions, you
can pick one of methods and not blindly apply either one of them.

HTH,
Bernhard

>
> Does this mean, that any kind of correlation analysis with
> stock market
> indices is senseless, since maybe we don't get a sign.
> correlation, but
> this doesn't mean that the series are independent?
>
> Many thanks for your help
>
> Chris
>
> _______________________________________________
> R-sig-finance at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>

--------------------------------------------------------------------------------
The information contained herein is confidential and is inte...{{dropped}}

```