Why 2 arrays have negative correlations when they have the same trend

25 Views Asked by At

I have price data for 2 stocks (each has 100 data points, one for each day)

price1 = [207.099, 203.751, 194.571, 194.201, 206.387, 207.047, 210.367, 210.98, 218.06, 218.3, 218.35299999999998, 214.79299999999998, 222.063, 226.269, 229.929, 238.029, 238.307, 240.557, 243.62699999999998, 245.027, 249.60699999999997, 250.267, 254.903, 260.27299999999997, 267.493, 270.6169, 284.31690000000003, 274.6669, 268.49060000000003, 269.3306, 275.2006, 277.0779, 285.9679, 294.28790000000004, 295.82460000000003, 277.5646, 282.2546, 259.8736, 278.0736, 286.1336, 291.05870000000004, 301.5287, 284.38870000000003, 302.0546, 305.9846, 301.50460000000004, 306.80600000000004, 312.75600000000003, 322.856, 331.4345, 331.3245, 307.3745, 273.6325, 303.9125, 316.5625, 321.6758, 338.34580000000005, 359.2658, 347.2043, 339.3743, 372.1943, 384.6272, 381.1172, 390.5272, 406.4997, 425.7697, 428.3297, 437.0526, 446.6826, 458.5826, 439.241, 467.00100000000003, 463.901, 482.9439, 460.0639, 447.7339, 462.9176, 426.44759999999997, 427.4276, 396.0597, 427.96970000000005, 412.3297, 378.94890000000004, 405.5989, 425.13890000000004, 403.6606, 425.7606, 416.4306, 429.878, 435.858, 437.698, 462.6642, 476.0642, 469.2142, 449.5767, 441.04670000000004, 476.2767, 495.4778, 502.4978, 525.6078]
price2 = [70828.36, 71210.98, 69765.4, 65808.63, 65781.16, 70393.05, 70834.64, 72104.23, 72267.13, 75121.79, 75315.8, 75428.84, 73758.22, 77029.86, 78509.31, 80007.79, 82976.75, 83031.88, 83903.83, 84747.65, 85528.29, 87124.45, 87251.57, 89392.27, 91321.09, 94100.86, 95036.73, 100080.65, 96361.83, 94440.68, 94798.25, 97444.25, 98105.34, 101379.35, 104868.75, 105036.09, 97261.52, 99266.46, 90041.44, 97772.13, 101195.09, 102648.01, 106730.02, 99848.92, 106807.62, 108343.69, 106149.31, 107957.56, 110220.15, 114378.01, 117638.0, 117549.39, 107935.74, 93064.98, 105393.53, 111060.81, 113592.55, 119999.27, 128611.09, 124016.84, 121339.68, 136131.36, 142188.88, 141708.46, 146227.39, 151297.51, 159067.94, 159745.59, 163781.78, 166575.4, 171332.11, 163642.7, 174621.88, 172017.16, 178572.38, 167784.8, 163500.16, 168786.49, 153550.3, 153138.93, 140308.28, 153490.38, 147740.42, 134028.5, 144959.57, 152543.77, 143567.56, 153453.35, 149859.92, 153796.13, 155406.07, 156040.76, 166692.13, 172626.0, 169270.72, 161146.75, 156907.27, 171605.15, 180715.11, 182702.53]

If I plot them they seem to have a very strong positive correlation

enter image description here

However, if I compute their correlation using the daily return (this is the standard way to compute stock correlations), they have negative correlation. I am totally confused about why the results are so contradicting. Appreciate any help.

enter image description here

0

There are 0 best solutions below