# APPENDIX 4

# Trigonometric Regression for Finding Cycles

The following computer programs and examples solve the cycle problems in Chapter 11.

## SINGLE-FREQUENCY TRIGONOMETRIC REGRESSION

The FORTRAN program *TRIG1* and the subroutine *LINREG* are used to find the single-frequency representation of the copper cycle. The program output is clearly separated into the following information:

- Input data, where each time period is the average cash price for a calendar quarter.
- The solution to the linear regression, giving the detrending line. With
*b*= .267, there is an inflationary bias of +.267¢ per quarter. - The detrended data resulting from subtracting the line values (2) from the original data (1).
- Intermediate values for
*α*,*ω*, and*T*. - The constant values
*a*and*b*for the normal equations solving the single-frequency problem. - The cycle resulting from the detrended data.
- The final cycle with the trend added back.

The results show a copper cycle of approximately 8.4 quarters, or slightly more than 2½ years.

An additional test was run on monthly cash corn prices from 1964 through 1983 to see if the seasonal cycle dominated the detrended pattern. The linear regression equation used for detrending was calculated as:

showing only a 1¢ per bushel per month rate of inflation, despite the bull markets in 1973 and 1980 through 1981. The cycle showed a period of 21.4 months, with the last highs in the ...

Get *New Trading Systems and Methods, Fourth Edition* now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.