Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

option to add a potential bias to the polls

  • Loading branch information...
commit 73759063e46332457ec7a37244839f0c8ee40122 1 parent 4d0ba19
@chris-taylor authored
Showing with 33 additions and 0 deletions.
  1. +33 −0 optimizeParams.matlab
View
33 optimizeParams.matlab
@@ -0,0 +1,33 @@
+function optimizeParams(year,window,method)
+
+ data = readData(year);
+
+ paramvals = linspace(0.0, 0.01, 11);
+
+ actual = loadResults(year);
+
+ brier = zeros(size(paramvals));
+ logLik = zeros(size(paramvals));
+
+ for ii = 1:length(paramvals)
+ munged = mungeData(data,window,method);
+ forecast = runModel(munged,0.0,paramvals(ii));
+ score = compareForecast(forecast,actual);
+
+ brier(ii) = score.brierScore;
+ logLik(ii) = score.logLikelihood;
+ end
+
+ figure;
+ plot(100*paramvals,brier);
+ xlabel('Poll error (%)')
+ ylabel('Brier Score')
+ title('Brier Score')
+
+ figure;
+ plot(100*paramvals,logLik)
+ xlabel('Poll error (%)')
+ ylabel('Negative log likelihood')
+ title('Negative log likelihood')
+
+end
Please sign in to comment.
Something went wrong with that request. Please try again.