% This program runs a simulation to determine each team's probability of making the % playoffs, or of winning the Super Bowl. The program reads an ASCII file, here named % gameprobsfile.txt. If seedweighttype=1, the program estimates each team's probability % of making the playoffs. If seedweighttype=2, the program estimates the teams' probabilities % of winning the SB, using the default formulation. If seedweighttype=3, the user overrides some % or all of the default probabilities by creating an appropriate input file weightoverrides.txt. % Index of teams: % 1 Buf 5 Balt 9 Hou 13 Den % 2 Mia 6 Cin 10 Ind 14 KC % 3 NE 7 Cle 11 Jax 15 Oak % 4 Jets 8 Pitt 12 TN 16 SD % 17 Dal 21 Chi 25 Atl 29 Ari % 18 NYG 22 Det 26 Car 30 StL % 19 Phil 23 GB 27 NO 31 SF % 20 Wash 24 MN 28 TB 32 Sea % Copyright 2006 by William S. Krasker numtrials=1000; % number of trials of simulation. % seedweighttype=1 to compute probability of making the playoffs. % seedweighttype=2 to compute probability of winning SB using default probabilities. % seedweighttype=3 to compute probability of winning SB using overrides to default probabilities. seedweighttype=2; load gameprobs.txt -ascii seedweights=ones(6,2); % weights equal 1 to estimate prob of making playoffs. if seedweighttype > 1 p=0.6; % default prob that home team wins. Pmatrix=p*ones(32,32); Qmatrix=0.5*ones(32,32); if seedweighttype==3 % use overrides to default probabilities. load weightoverrides.txt -ascii % read array containing overrides to defaults. for i=1:size(weightoverrides,1) Pmatrix(weightoverrides(i,1),weightoverrides(i,2))=weightoverrides(i,3); Pmatrix(weightoverrides(i,2),weightoverrides(i,1))=1-weightoverrides(i,4); Qmatrix(weightoverrides(i,1),weightoverrides(i,2))=weightoverrides(i,5); Qmatrix(weightoverrides(i,2),weightoverrides(i,1))=1-weightoverrides(i,5); end end end rand('state',0); probofplayoffs=zeros(32,1); for trial=1:numtrials a=gameprobs; u=rand(256,1); for j=1:256 if gameprobs(j,3)==-1 % tie game. a(j,3)=-1; else if u(j) <= gameprobs(j,3) a(j,3)=1; else a(j,3)=0; end end end setup standings seeddivwinners getwcteams if seedweighttype > 1 seedweights=getsbwinprobs(seeds,Pmatrix,Qmatrix); end for i=1:6 probofplayoffs(seeds(i,1))=probofplayoffs(seeds(i,1))+seedweights(i,1); probofplayoffs(seeds(i,2))=probofplayoffs(seeds(i,2))+seedweights(i,2); end end probofplayoffs=probofplayoffs/numtrials; format long [(1:32)' probofplayoffs] format short