1
$\begingroup$

Say I had a pool of companies (specifically the Latin American Countries). The task was to work out the 'Correlation coefficient between the returns of any 2 companies selected from "different countries and different sectors" in the Latin American region. Instead of just working out that coefficient, there are 4 variations of the task I wish to do:

  1. same country & same sector
  2. same country & different sector
  3. different country & same sector
  4. different country & different sector

How would you go about doing this?
I've started by gathering stock price info on certain companies and then have created a matrix with the correlations of every pair's stock price returns, then from there in order to get specific categories I need to choose the right pairs of companies and then average those coefficients.

$\endgroup$

1 Answer 1

1
$\begingroup$

I suppose there will be "4 variations" in your correlation matrix then, and even within each of these variations, there are different versions. For example, in case (1.), there could be Brazil-Industrial and Argentina-Financial (and the companies that exist within that specific country-sector).

Before anything, I would create a dataframe containing the IDs of all the companies for the sake of the next 4 variations.

  1. Same Country Same Sector - I would perform a group-by using the country and sectors to filter for all the different combinations with the same country and sectors and compute their correlation matrices.
  2. Same Country Diff Sector - Just a group-by using the country and compute the correlation matrices (obviously there will be companies that have the same sector in this case, but if you want a group with all different sectors there will be "infinite" combinations of groups with various sizes).
  3. Diff Country Same Sector - Just a group-by using the sector and compute the correlation matrices with the same drawbacks as (2.).
  4. Diff Country Diff Sector - I would reckon that this is just the matrix that you have computed in the above.

I don't think this is the best answer, but hopefully it starts the discussion and gives you some ideas.

$\endgroup$

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.