ListCorrelate applied to the Dow Jones
- To: mathgroup at smc.vnet.net
- Subject: [mg23860] ListCorrelate applied to the Dow Jones
- From: "Hermann Meier" <hmeier at webshuttle.ch>
- Date: Mon, 12 Jun 2000 01:17:54 -0400 (EDT)
- Organization: EUnet AG, Switzerland. A KPNQwest Company.
- Sender: owner-wri-mathgroup at wolfram.com
The Dow Jones may be searched for a largest drop from peak to trough, ignoring local peaks and local troughs. As a first step, I tried to do this just for the years 1924 ... 1939 (Dec 31). dj = {{1924, 120.51}, {1925, 156.66}, {1926, 157.2}, {1927, 202.4}, {1928, 300}, {1929, 248.5}, {1930, 290}, {1931, 77.9}, {1932, 59.93}, {1933, 99.9}, {1934, 104.04}, {1935, 144.13}, {1936, 179.7}, {1937, 120.85}, {1938, 154.76}, {1939, 150.24}}; The value for 1930 is 164.6; I changed this here to 290, introducing a fictious, irrelevant local peak. djval = Transpose[dj]//Last; insli = NestList[Insert[#, 0, 2] &, {-1, 1}, Length[djval] - 2]; Map[ListCorrelate[#, djval] &, insli]//Min The result (-240.07) is correct in this case. My questions: - Is this code "conceptually sound" ? - How can the code be improved upon, for example with the help of NestWhileList ? - How can I get a more verbose result like {{1928,300},{1932,59.53},-240.07} ? I would appreciate your suggestions. With regards Hermann Meier