. The sequence 4%, %, % ..., (4)” is exactly the same as in the discussion ofthe Theory of Runs. The probability of successive losses can be calculated as the likelihoodof a run of the same length, (4)"*?.
  
 
FIGURE 23-14 Pascal's triangle.
 
 
 
 
 
 
 
 
 
COMPARING EXPECTEL «ND ACTUAL RESULTS 627
A binomial distribution is useful in considering the total number of losses that canoccur in any order within a sequence of trades; it is the probability of getting to a specificpoint at the base of Pascal’s triangle when there is a high probability of moving to the left(losses) rather than the right (profits). The formula for the binomial probability is:
nl
yh’ a - py"!
Boe. = Ta
where / is the number of lossesnis the total number of triesP is the probability of a loss
and the symbol “t” is the factorial (e.g. 5!=5 x 4x3x2x* 1)
Consider the first 5 trades of a system with a probability of success of 4, How manylosses should be expected? To answer the question, find the binomial probability B for allpossibilities and form a distribution function. Let / = 4. Then,
B(4:.667,5) = Faoo7y" (333)!
= 120 19792) (.333)= Hy (197920333),
= 5x 0659 = 32954
The binomial probability of having 4 losses out of the first 5 trades is about 33%. Thefollowing table shows the probability of losses for the first 5, 10, and 15 trades of a system,with a % predicted reliability. Results show the highest probability of occurrence of loss isat the % point (mean) for each sequence, but the standard deviation gives the range of vari-ance about the mean, so that from 2.3 to 4.4, losses are expected in every 5 trades, 5.2 to8.2 in 10 trades, and 8.2 to 11.8 losses in 15 trades (Table 23-7).
Note that in the 5-trade example, the chances of no losses is only 1%, and there is a13% chance of all losses. For the purpose of evaluation, it is easier to look at the maximumrather than the minimum number of losses. For 15 trades, there is an 8% chance of 13 ormore losses; if the system has produced more than 12 losses in that period, there is some-thing wrong with the predicted reliability.
In addition to the Pascal distribution, the reader may find the Poisson and variousskewed distribution functions have application to system evaluation.
42-—Chi-Square Test
Once a system has been traded and there is enough data to give a performance profile, thesignificance between these actual results and the expected results can be found using thechi-square test. First, there must be enough data for a relevant answer. From the section onsampling, the formula for error is 1/VN, where N is the number of items sampled. If there —are 25 trades, the expected error in the calculation is 1/V’25, or 20%; 160 trades would giveresults accurate to 10%. .
Assume that the real trading results show a reliability of 20% (1 out of 5) as comparedwith the expected reliability of 35%. What are the chances of getting these results? The chi-square test is(O-E* ~
= -
   
where O is the observed, or actual result, and & is the expected or theoretical result. Then, 
628- RISK CONTROL,
 
TABLE 23-7 The ProDability of a Specific Number of Losses
 
 
 
   
 
5 Trades 10 Trades 15 TradesProbability Probability ProbabilityLosses (%) Losses (%) Losses (%)° 1 0 0 ° 0l 4 1 0 1 02 16 2 0 2 03 33 3 2 3 04 33 4 5 4 05 13 5 14 5 16 23 6 27 26 7 68 19 8 HW9 9 9 18lo 2 fo 2W 2012 1313 614 21s °m=64 m=l04 sd=15 1.825eeeMean.+ Standard deviation._ (20-35)? + (80 — 65)?35 6545)? (15)?= £35)" 15)35 65225 225 \= + > = 6.428 +3435 6 6, + 3.46=9.89
The percentage of actual winning trades is compared with the anticipated winningtrades and the losing trades with the expected losing-trades. The answer must be found inthe first row of Table 23-8, which gives the distribution of x7.
‘The probability is distributed unequally in the table because the results are only sig-nificant if the probability is small, showing less likelihood of the results occurring bychance. For this simple two-element test, the result P is classified as
Highly significant if P> 10.83 (.1% or 1/1,000) ~~Significant: if P 2 6.64 (1% or 1/100)Probably significant if P 2 3.84 (5% or 1/20)_The answer 7? = 9.89 is between .1% and 1% showing significance. For a large sample, theactual reliability should not have been 20% when 35% was expected.~The chi-square test can be used to compare actual price movement with random pat-terns to see whether there is appreciable variation. In the section on the Theory of Runs,Table 23-9 showed:
COMPARING EXPECTED AND ACTUAL RESULTS. 629
—TABLE 23-8 Distribution of x?
Probability of Occurring by Chance
 
 
CasesLess | 70 50 30 20 10 05 02 OF 004I IS 46 1.07 le4 2.71 3.84 SAI 6.64 10.832 a 139 241 3.22 461 5.99 7.82 9.21 13.823 142 2.37 3.67 4.64 6.25 7.82 9.84 134 16.274 2.20 3.36 488 5.99 778 9.49 11.67 13.28 18.475 3.00 4.35 6.06 7.29 9.24 11.07 13.39 15.09 20.526 3.83 5.35 7.23 8.56 10.65 12.59 15.03 16.81 22.467 4.67 6.35 8.38 9.80 12.02 14.07 16.62 18.48 24,328 5.53 7.34 9.52 11.03 13.36 15.51 18.17 20.09 26.139 6.39 8.34 10.66 12.24 14.68 16.92 19.68 21.67 27.8810 7.27 9.34 178 13.44 15.99 18.31 21.16 23.21 29.59
 
TABLE 23-9. Results from Analysis
 
 
of RunsExpected ActualLength Results Resultsof Run (é) (0)1 1225 12142 612 6203 306 3H4 153 1675 7 o76 38 4l7 19 168 10 59 5 3. 210 4 5.2 8* 9 B
 
The last groups were combined In order not to dis~tort the results based on a small sample.
Applying the actual data for runs of one through eight against a random distribution,
» (0, -£?gay Ge
 
 
_ (1244 = 1225)? | 620-612)", (311 ~ 306)* | (167 ~ 153)"= 1225 612 — 306 1532 — 38)? ~19)2 19)?GT TM? , 1-38)? , 6-19)? | 03 ~ 19)77 38 19 19o @ @) «@) 3)= .09877 + 10457 + .08169 + 1.2810 + 1.2987- © o ® we
.23684 + .47368 + 1.8947= 5.470 
630 RISK CONTROL
‘table 23-8 gives the probability of about 55% for 8 cases. The results are not significant; the‘Theory of Runs shows that all cases taken together give the same patterns as chance move-ment. Individual runs or sets of two or three adjacent runs can be inspected for distortion.In both cases, the results are further from normal but not mathematically significant. Thetwo runs that differed the most were 4 to 5 days, which showed an 11% probability ofoccurring by chance.
Highly significant price rans can be found in the occurrence of extended runs, forexample, 20 days, which is experienced occasionally in trending markets. By looking at theasymmetry of price movement, where a reverse run of 1 day is of negligible value, the sig-nificance of these runs will dramatically increase. Price movement is not a simple matter of
random runs and equal payout
 
- APPENDIX |a
Statistical Tables
PROBABILITY DISTRIBUTIONS TABLES
 
TABLE AI-| Normal Curve Areas
 
 
 
 
Ol 02 03 04 OS 06 07 08
0040 = -.0080 0120. 01600199 0239027903190438 «= «.0478- 0517, 0557 = 0596 063606750714
 
08320871. 0910 0948 = 098710261064 1103,121712551293, .1331 1368-1406 1443 148015911628 166417001736 1772 «18081844
19501985 2019-2054 2088-2123, 2157-2190
229123242357 238924222454 248625172612 2642 -2673 .2704 2734 ~ 2764 2794 2823
291029392967 2995 3023, 3051307831063186 321232383264 32893315 334033653438 3461 3485 3508 3531 3554 3877 3599
3665, 3686 3708 3729 3749 3770 3790 38103869-3888. 3907,- 39253944 «3962398039974049 4066-4082, 409941154131 4IAT 4162.4207 4222_— 4236 ADS1— A265 4279429243064345 43574370, 43824394 440644184429
44630 447444840 44954505 451545254535,4564 = AS7T3.—s«4582— A591 4599 46084616 4625464946560 466446714678 468646934699ANID A726 4732 A738 AT44 4750 ATS6 AT6I4778 = 4783.— A783 AS34798 4803. 4808-4812.
A826 4830 4834 4838 4842 A846 4850 A8544864 4868 = 487148754878 488148844887
4896 = 4898 49014904 49064909 AIT A9EB.4920-4922. 4925, 4927 4929-4931 493249344940 A941 494349454946 4948 494949514958 4956 ASST 495949604961 AED 4963
4966 496749684969 4970 497149724973A978 AST6. = ASTT._— ATT ADB4982" 4982-4983 4984-4984A983 A988 A989
       
632” APPENDIX I APPENDIX 1 - 633
 
 
  
TABLEAI Distribution TABLE OF UNIFORM RANDOM NUMBERS—_——J 2 3 4 5 6 7 8 9 10 nM
 
10480 15011 01536 02011 81647 91646 69179 14194 62590 36207 2096922368 46573-25595 85393 30995 89198 27982 53402-93965 34095 5266624130 48360 22527 97265 76393 64809 [5179 24830 49340 3208! 3068042167 93093 06243 61680 07856 «16376-39440 5353771341 $7004 0084937570 39975 81837 16656 06121-91782 60468 «81305 49684 «6067214110
12345< 6 77921 06907 11008 42751 27756 53498 18602 70659 90655 15033 21916789
of 10 08 025 1 005 99562 72905 56420 69994 98872 31016 71194 18738 44013 44840 63213
t 3.078 6.314 12.706 31.821 63.657 96301 91977 05463 07972 18876 20922 94595 56869 69014 60045 18425
2 1.886 2.920 4.303 6.965 9.925, 89579 14342 6366) 10281 17453, 18103 57740 84378 25331 12566 58678
3 1.638 2.353 3.182, 4541 5.841 10 85475 36857 53342 53988 53060 59533 38867 62300 08158 17893 16439
i 133 nae ie ee +e It 28918 69578 8823! 33276 70997 79936 56865 05859 90106 31595 91547
~ ~ ” 12 63553 40961 48235 03427 49626 69445 18663 72695 52180 20847 12234
6 1.440 1.943 2447 3.143, 3.707, 43 09429 93969 52636 92737 88974 33488 36320 17617 30015 07272 84iI5
7 1.415 1.895, 2365 2.998 3.499 M4 10365 61129 87529 85689 48237 52267 67689 93394 OISIt 26358 85104
8 1.397 1.860 2.306 2.896 3.355, 15 O7119 97336 71048 08178 77233 13916 47564 81056 97735 85977 29372Bee aaee 16 51085 12765 $1821 51259 77452 16308 60756 92144 49442 53900 70960
~ 17 02368 21382 52404 60268 89368 19885 55322 44819 O1I88 65255 64835
i} 1.363, 1.796 2.201 2718 3.106 18 O1OI! 54092 33362 94904 31273 04146 18594 29852 71585 85030 $1132
12 1.356 1.782 LA79 2.681 3.055 19 52162 53916 46369 58586 23216 14513 83149 98736 23495 64350 94738
13 1.350 L771 2.160 2.650 3.012 20 07056 97628 33787 09998 42698 0669! 76988 13602 S!8S1 46104 88916
Q Be 38 at pene cei 21 48663 91245 85828 14346 09172 30168 90229 04734 59193 22178 30421
. ~ ~ 22 «54164 «58492-22421 74103 47070 25306 76468 26384 S8ISI 06646 21524
16 1.337 1.746 2.120 2.583 2.921 ~ 23 32639 32363 05597 24200 13363 38005 94342 28728 35806 06912 17012
7 1.333 1.740 2.140 2.567 2.898 24 29334 27001 87637 87308 58731 00256 45834 15398 46557 41135 10367
1s 1.330 1.734 2401 2.552 2.878 25 02488 33062 28834 07351 19731 92420 60952 61280 SOOO! 67658 32586
a . 8 oe We 303 3539 aoe 26 81525 72295 04839 96423 25878 82651 66566 14778 76797 14780 13300. " 27 + «©29676 ©2059! 68086 26432 46901 20849 80768 81536 86645 12659 92259
- 2 1.323 1.721 2.080 2518 2831 28- 00742 57392 39064 66432 84673 40027 32832 61362 98947 96067 64760
22 1.321 L717 2.074 2.508 2819 ’ 29° 05366 04213 25669 «26422 «44407 «44048 «37937 «63904 «45766 «66134 = 75470
23 1319 174 2.069 2.500 2.807 30 91921 26418 64417 94305 26766 25940 39972 22209 71500 64568 91402
: 3 8 i oe 2068 ee ae 31 00582 «04711 87917 77341 42206 35126 74087 99547 81817 42607 43808Ay ° . ~ ” 32 00725 69884 62797 S6170 86324 88072 76222 36086 84637 9316) 7603826 LS 1.706 2.056 2479 2.779 33 69011 65795 95876 55293 18988 27354 26575 08625 40801 59920 2984127 L314 1.703 2.052 2.473 2771 34 25976 57948 29888 88604 67917 48708 18912 82271 65424 69774 33611
28 1313 4.705 2.048 2467 2.763 35 09763 «83473. -73577_ 12908 30883 10317 28290 35797 05998 41688 = 34952.
2 3 to ' a On ue 378 36 91567 42595 27958 30134 04024 86385 29880 99730 55536 84855 29080
. . ~ ~ 37 17955 $6349 90999-49127 20044-5993) O61IS 20542 18089 02008 73708
7 40 1.303 4.684 2.021 2.423 2.704 - 38 46503 18584 18845 49618 02304 51038 2065S $8727 28168 15475 $6942
7” 60 1.296 1.671 2.000 2390- 2.669 39 92157 89634 94824 78171 84610 82834 09922 25417 44137 48413 25555
120 1.289 1.658 1,980 2.388 2617 40 14577 62765 35605 81263 39667 47358 54873 56307 61607 49518 89565
- ee 08487762765 35608 She ese? ese OE
 
9NAS 1860 2975 28S Source: Francis F aren, Computer Madalng and Stulaton (ohn Wey & Sans, 1968p. 208 (reprinted by permsion))
Sovtce: Hoel, Elementary Statistics, 34 ed. (John Wiley & Sons, New York,1971),
 
t'
 \|
 
APPENDIX 2a
Method of Least Squares
The following programs, written in Microsoft FORTRAN for the IBM PC,! solve the two-variable regression analysis using the method of least squares. The program allows for theregression of two series against one another, and the regression of one series against time.
OPERATING INSTRUCTIONS
In the following example, the user’s entries are underlined:
LSTSQ
Enter data tn sets of 2 (Y then X).
If second variable is omitted, sequential numbers will be used for x.Extra <return> ends input.
Enter below:
YYYYYY XXXXXX
L2z 2.43‘L19  2.26<BETURN>
Print data (Y/N)? Y¥
(Computer prints data and solutions)Sampie results (Y¥/N)?7¥
Enter start, enSSs5ss eeeeee i1.007.900 50(Computer prints sample results)Plot resuits (Y/N)?7y¥Name for X-scale (9 chars)?SOYBEANSName for Y-scale (9 chars)?CORNWhich plot?
LinearLogarithmicExponential: CurvilinearWhich number? 1
nd increments belowti
 
 
(Computer plots)Another plot (Y/N)2Y
Which plot?1: Linear . “
(and so forth)
COMPUTER PROGRAMS
1 STITLE: "LSTSQ: LEAST SQUARES' ~2 SSUBTITLE: ‘COPYRIGHT 1986. P J KAUFMAN’ . . -
 
* BASIC programs for both plotting and least-squares regeession can be found in ER. Ruckdeschel, BASIC