{"id":884,"date":"2014-04-25T07:15:47","date_gmt":"2014-04-25T12:15:47","guid":{"rendered":"https:\/\/blogs.mathworks.com\/loren\/?p=884"},"modified":"2016-08-07T13:42:23","modified_gmt":"2016-08-07T18:42:23","slug":"election-poll-analysis-in-matlab","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/loren\/2014\/04\/25\/election-poll-analysis-in-matlab\/","title":{"rendered":"Election Poll Analysis in MATLAB"},"content":{"rendered":"<div class=\"content\"><!--introduction--><p>This is a mid-term election year here in the United States, and today's guest blogger, Toshi Takeuchi, invites you to try election poll analysis with MATLAB for fun.<\/p><!--\/introduction--><h3>Contents<\/h3><div><ul><li><a href=\"#e7ea9e2a-12e7-4943-b1a3-5415144c3c10\">Why election polls?<\/a><\/li><li><a href=\"#064790aa-c70c-4551-82b5-26d2bcf47b5e\">Does national politics affect local election?<\/a><\/li><li><a href=\"#629b49ec-9994-4127-be60-b7d4152ef13e\">Could this have been caused by national politics?<\/a><\/li><li><a href=\"#ed1d5a61-353b-4f54-932e-32e54349e00d\">All politics is perhaps local<\/a><\/li><li><a href=\"#d86bb497-2ac1-4726-b2f8-d12cecab6cda\">MATLAB example with Pollster API and JSONlab<\/a><\/li><li><a href=\"#60873f44-400d-4fe8-b830-e6a2221a3e91\">Convert the data into a table<\/a><\/li><li><a href=\"#cf74d4bd-78e9-4940-a54c-f39260d80c12\">Remove missing values<\/a><\/li><li><a href=\"#887b8ee6-9960-4b00-844a-09d0fb02d4ba\">Plotting Obama Job Approval<\/a><\/li><li><a href=\"#67eb99e9-cdec-4a31-82e4-5f7c99c09966\">Automate the process with object oriented programming<\/a><\/li><li><a href=\"#f4f26880-e03a-44e3-a9db-f1e17b017816\">Have I whetted your appetite?<\/a><\/li><\/ul><\/div><h4>Why election polls?<a name=\"e7ea9e2a-12e7-4943-b1a3-5415144c3c10\"><\/a><\/h4><p>Availability of abundant data, coupled with a very impressive success of a political outsider, Nate Silver, who made correct calls in the last two presidential elections, turned election poll analysis one of a fertile playgrounds for hobbyists to apply their data analytics skills for fun.<\/p><p>In this post, I would like to share an example of such analysis using a recent outcome of the special congressional election in Florida, along with a simple example of getting election poll data from Pollster website in JSON format and automating the data pull process with object oriented programming.<\/p><h4>Does national politics affect local election?<a name=\"064790aa-c70c-4551-82b5-26d2bcf47b5e\"><\/a><\/h4><p>There was a race in Florida recently that was supposedly a test case for how Obama&#8217;s healthcare law impacts the mid-term election. Or was it?<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/loren\/2014\/figure_02.png\" alt=\"\"> <\/p><p>What you can see in this plot is that the number of undecided voters suddenly dropped, and both Sink (D) and Jolly (R) benefited from it, but larger percentage of those voters actually ended up voting for Jolly, rather than Sink. This rapid shift happened around Feb 5 &#8211; 12. What I expected was a smoother decline of undecided voters over time, perhaps more accelerated toward the election day.<\/p><h4>Could this have been caused by national politics?<a name=\"629b49ec-9994-4127-be60-b7d4152ef13e\"><\/a><\/h4><p>If you believe the pundits, then national issues like the healthcare law affects the local politics. Let&#8217;s use Obama&#8217;s job approval rating as a proxy to check it out.<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/loren\/2014\/figure_04.png\" alt=\"\"> <\/p><p>As you can see in the plot, Obama&#8217;s national poll was actually going up towards the end of this election. This should have benefited Sink.<\/p><h4>All politics is perhaps local<a name=\"ed1d5a61-353b-4f54-932e-32e54349e00d\"><\/a><\/h4><p>Actually, it is more important to see the local trend rather than the national trend. So use the polls from Florida alone to see the local Obama Job Approval trend.<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/loren\/2014\/figure_03.png\" alt=\"\"> <\/p><p>Obama's Job Approval was recovering at the national level, but his approval was actually going down in Florida during this election. I am wondering what was happening around the time that the undecideds suddenly decided in the beginning of February.  But can you really say this was the test of Obamacare?<\/p><p>National news headlines around that time:<\/p><div><ul><li>Philip Seymour Hoffman died<\/li><li>Sochi Olympics coverage<\/li><li>Farm bill passing Senate<\/li><li>House approved debt limit ceiling hike<\/li><\/ul><\/div><p>Let me know if you have good data sources to test this claim. In my opinion, Obamacare alone doesn't seem to fully explain this rapid shift.<\/p><h4>MATLAB example with Pollster API and JSONlab<a name=\"d86bb497-2ac1-4726-b2f8-d12cecab6cda\"><\/a><\/h4><p>Now I would like to address the programming aspect of this post. <a title=\"http:\/\/elections.huffingtonpost.com\/pollster\/api (link no longer works)\">Pollster API<\/a> provides convenient access to the data from election polls. There are other websites that aggregate election polls; this API was the easiest to use. JSON is a popular format for web services like this, and you can install an appropriate library from the FileExchange to process it. My favorite is <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/33381-jsonlab--a-toolbox-to-encode-decode-json-files\">JSONlab by Qianqian Fang<\/a>.<\/p><p>Let&#8217;s start out with an simple example of getting data for Obama Job Approval Ratings.<\/p><pre class=\"codeinput\">baseUrl=<span class=\"string\">'http:\/\/elections.huffingtonpost.com\/pollster\/api\/charts'<\/span>;\nslug = <span class=\"string\">'obama-job-approval'<\/span>;\nrespFormat = <span class=\"string\">'json'<\/span>;\nfullUrl = sprintf(<span class=\"string\">'%s\/%s.%s'<\/span>,baseUrl,slug,respFormat);\n\n<span class=\"comment\">% add jsonlab to the search path<\/span>\naddpath <span class=\"string\">jsonlab<\/span>;\n<span class=\"comment\">% get the poll data<\/span>\ndata=loadjson(urlread(fullUrl));\n<\/pre><h4>Convert the data into a table<a name=\"60873f44-400d-4fe8-b830-e6a2221a3e91\"><\/a><\/h4><p>JSON stores data in a nested tree structure like XML, so we need to convert it into a table in order to use the data in MATLAB. <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/tables.html\"><tt>table<\/tt><\/a> is a new feature introduced in R2013b that I like quite a lot.<\/p><pre class=\"codeinput\"><span class=\"comment\">% initialize variables<\/span>\nestimates=data.estimates_by_date;\ndate = zeros(length(estimates),1);\napprove = zeros(length(estimates),1);\ndisapprove = zeros(length(estimates),1);\nundecided = zeros(length(estimates),1);\n\n<span class=\"comment\">% loop over JSON tree<\/span>\n<span class=\"keyword\">for<\/span> i = 1:length(estimates)\n    date(i) = datenum(estimates{i}.date);\n    <span class=\"keyword\">for<\/span> j = 1:length(estimates{i}.estimates)\n        <span class=\"keyword\">if<\/span> strcmpi(<span class=\"string\">'approve'<\/span>,estimates{i}.estimates{j}.choice)\n            approve(i) = estimates{i}.estimates{j}.value;\n        <span class=\"keyword\">elseif<\/span> strcmpi(<span class=\"string\">'disapprove'<\/span>,estimates{i}.estimates{j}.choice)\n            disapprove(i) = estimates{i}.estimates{j}.value;\n        <span class=\"keyword\">else<\/span>\n            undecided(i) = estimates{i}.estimates{j}.value;\n        <span class=\"keyword\">end<\/span>\n    <span class=\"keyword\">end<\/span>\n<span class=\"keyword\">end<\/span>\n\n<span class=\"comment\">% consolidate the data into a table<\/span>\nestimates = table(date,approve,disapprove,undecided);\ndisp(estimates(1:5,:))\n<\/pre><pre class=\"codeoutput\">       date       approve    disapprove    undecided\n    __________    _______    __________    _________\n    7.3571e+05      44       51.5            0      \n    7.3571e+05      44       51.6          4.8      \n    7.3571e+05    43.9       51.6            0      \n     7.357e+05    43.9       51.6          4.8      \n     7.357e+05    43.9       51.6          4.8      \n<\/pre><h4>Remove missing values<a name=\"cf74d4bd-78e9-4940-a54c-f39260d80c12\"><\/a><\/h4><p>Real data is never perfect, so we need to check for missing values and remove affected rows.<\/p><pre class=\"codeinput\"><span class=\"comment\">% get the indices of zero values<\/span>\nisMissing = table2array(estimates) == 0;\n<span class=\"comment\">% get the count of missing values by variable<\/span>\ndisp(<span class=\"string\">'number of missing values by variable'<\/span>)\ndisp(array2table(sum(isMissing),<span class=\"string\">'VariableNames'<\/span>,estimates.Properties.VariableNames));\nobamaDecided = estimates(~(isMissing(:,2) | isMissing(:,3)),1:3);\nobamaUndecided = estimates(~isMissing(:,4),[1 4]);\n<\/pre><pre class=\"codeoutput\">number of missing values by variable\n    date    approve    disapprove    undecided\n    ____    _______    __________    _________\n    0       1          1             205      \n<\/pre><h4>Plotting Obama Job Approval<a name=\"887b8ee6-9960-4b00-844a-09d0fb02d4ba\"><\/a><\/h4><p>In the final step, let's validate the data processing so far by plotting the data and compare it to the chart on Pollster website.<\/p><p>\n<\/p><pre class=\"codeinput\">figure\nplot(obamaDecided.date,obamaDecided.approve,<span class=\"string\">'k-'<\/span>,<span class=\"string\">'LineWidth'<\/span>,2)\nhold <span class=\"string\">on<\/span>\nplot(obamaDecided.date,obamaDecided.disapprove,<span class=\"string\">'r-'<\/span>,<span class=\"string\">'LineWidth'<\/span>,2)\nh = plot(obamaUndecided.date,obamaUndecided.undecided,<span class=\"string\">'b-'<\/span>,<span class=\"string\">'LineWidth'<\/span>,2);\nset(h, <span class=\"string\">'color'<\/span>, [0.7 0.7 0.7])\ndatetick\nxlabel(<span class=\"string\">'Date'<\/span>)\nylabel(<span class=\"string\">'Estimate'<\/span>)\nlegend(<span class=\"string\">'Approve'<\/span>,<span class=\"string\">'Dispprove'<\/span>,<span class=\"string\">'Undecided'<\/span>,<span class=\"string\">'Location'<\/span>,<span class=\"string\">'East'<\/span>)\ntitle(data.title)\nxlim([datenum(<span class=\"string\">'2009-01-01'<\/span>) Inf])\nhold <span class=\"string\">off<\/span>\n<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/loren\/2014\/ElectionPollAnalysis_01.png\" alt=\"\"> <h4>Automate the process with object oriented programming<a name=\"67eb99e9-cdec-4a31-82e4-5f7c99c09966\"><\/a><\/h4><p>As you can see, this is an iterative process, so it is a good idea to automate some of the steps. Let&#8217;s use <a title=\"https:\/\/www.mathworks.com\/discovery\/object-oriented-programming.html (link no longer works)\">object oriented programming<\/a> to facilitate the data pull using a custom class called <a href=\"https:\/\/blogs.mathworks.com\/images\/loren\/2014TaxCode\/myPollster.m\"><tt>myPollster<\/tt><\/a>. This way, all the processed data is encapsulated in the object itself, and you don&#8217;t run into namespace issues.<\/p><p>The <tt>myPollster<\/tt> class also provides a utility method to return the logical indices of missing values in the table.<\/p><pre class=\"codeinput\"><span class=\"comment\">% instantiate the object<\/span>\nFL13 = myPollster();\n<span class=\"comment\">% specify the slug for the data pull<\/span>\nslug = <span class=\"string\">'2014-florida-house-13th-district-special-election'<\/span>;\n<span class=\"comment\">% call the API and store the result in the object.<\/span>\nFL13.getChartData(slug);\n<span class=\"comment\">% check the result<\/span>\ndisp(FL13.title)\ndisp(FL13.T(1:5,:))\n\n<span class=\"comment\">% Check for missing values<\/span>\ndisp(<span class=\"string\">'check which variable contains missing values...'<\/span>)\ndisp(array2table(sum(FL13.isMissing),<span class=\"string\">'VariableNames'<\/span>,FL13.T.Properties.VariableNames))\n<\/pre><pre class=\"codeoutput\">2014 Florida House: 13th District Special Election\n       Date       Sink    Jolly    Overby    Undecided\n    __________    ____    _____    ______    _________\n    7.3567e+05      46    44.3     6.4       3.3      \n    7.3567e+05      46    44.3     6.4       3.3      \n    7.3567e+05      46    44.3     6.4       3.4      \n    7.3567e+05    45.9    44.3     6.4       3.4      \n    7.3567e+05    45.9    44.3     6.4       3.4      \ncheck which variable contains missing values...\n    Date    Sink    Jolly    Overby    Undecided\n    ____    ____    _____    ______    _________\n    0       0       0        28        0        \n<\/pre><h4>Have I whetted your appetite?<a name=\"f4f26880-e03a-44e3-a9db-f1e17b017816\"><\/a><\/h4><p>Hopefully this simple example was sufficient to get you interested in trying it yourself. In this example, I simply took the smoothed trend lines provided by Pollster, but you could also get individual poll data and build more complex model to make some prediction yourself.<\/p><p>Toshi<\/p><script language=\"JavaScript\"> <!-- \n    function grabCode_80859847a3ba4d7186d46b23117fe3b2() {\n        \/\/ Remember the title so we can use it in the new page\n        title = document.title;\n\n        \/\/ Break up these strings so that their presence\n        \/\/ in the Javascript doesn't mess up the search for\n        \/\/ the MATLAB code.\n        t1='80859847a3ba4d7186d46b23117fe3b2 ' + '##### ' + 'SOURCE BEGIN' + ' #####';\n        t2='##### ' + 'SOURCE END' + ' #####' + ' 80859847a3ba4d7186d46b23117fe3b2';\n    \n        b=document.getElementsByTagName('body')[0];\n        i1=b.innerHTML.indexOf(t1)+t1.length;\n        i2=b.innerHTML.indexOf(t2);\n \n        code_string = b.innerHTML.substring(i1, i2);\n        code_string = code_string.replace(\/REPLACE_WITH_DASH_DASH\/g,'--');\n\n        \/\/ Use \/x3C\/g instead of the less-than character to avoid errors \n        \/\/ in the XML parser.\n        \/\/ Use '\\x26#60;' instead of '<' so that the XML parser\n        \/\/ doesn't go ahead and substitute the less-than character. \n        code_string = code_string.replace(\/\\x3C\/g, '\\x26#60;');\n\n        copyright = 'Copyright 2014 The MathWorks, Inc.';\n\n        w = window.open();\n        d = w.document;\n        d.write('<pre>\\n');\n        d.write(code_string);\n\n        \/\/ Add copyright line at the bottom if specified.\n        if (copyright.length > 0) {\n            d.writeln('');\n            d.writeln('%%');\n            if (copyright.length > 0) {\n                d.writeln('% _' + copyright + '_');\n            }\n        }\n\n        d.write('<\/pre>\\n');\n\n        d.title = title + ' (MATLAB code)';\n        d.close();\n    }   \n     --> <\/script><p style=\"text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray\"><br><a href=\"javascript:grabCode_80859847a3ba4d7186d46b23117fe3b2()\"><span style=\"font-size: x-small;        font-style: italic;\">Get \n      the MATLAB code <noscript>(requires JavaScript)<\/noscript><\/span><\/a><br><br>\n      Published with MATLAB&reg; R2014a<br><\/p><\/div><!--\n80859847a3ba4d7186d46b23117fe3b2 ##### SOURCE BEGIN #####\n%% Election Poll Analysis in MATLAB\n% This is a mid-term election year here in the United States, and today's \n% guest blogger, Toshi Takeuchi, invites you to try election poll analysis\n% with MATLAB for fun.\n%\n%% Why election polls?\n% Availability of abundant data, coupled with a very impressive success of \n% a political outsider, Nate Silver, who made correct calls in the last \n% two presidential elections, turned election poll analysis one of a \n% fertile playgrounds for hobbyists to apply their data analytics skills \n% for fun.\n% \n% In this post, I would like to share an example of such analysis using a \n% recent outcome of the special congressional election in Florida, along \n% with a simple example of getting election poll data from Pollster\n% website in JSON format and automating the data pull process with\n% object oriented programming.\n%\n%% Does national politics affect local election?\n% There was a race in Florida recently that was supposedly\n% <http:\/\/www.huffingtonpost.com\/2014\/03\/11\/florida-special-election_n_4937699.html \n% a test case for how Obama\u00e2\u20ac\u2122s healthcare law impacts the mid-term election>. \n% Or was it?\n% \n% <<figure_02.png>>\n% \n% What you can see in this plot is that the number of undecided voters\n% suddenly dropped, and both Sink (D) and Jolly (R) benefited from it, but\n% larger percentage of those voters actually ended up voting for Jolly,\n% rather than Sink. This rapid shift happened around Feb 5 \u00e2\u20ac\u201c 12. What I\n% expected was a smoother decline of undecided voters over time, perhaps\n% more accelerated toward the election day.\n%\n%% Could this have been caused by national politics?\n% If you believe the pundits, then national issues like the healthcare law \n% affects the local politics. Let\u00e2\u20ac\u2122s use Obama\u00e2\u20ac\u2122s job approval rating as a \n% proxy to check it out.\n%\n% <<figure_04.png>>\n%\n% As you can see in the plot, Obama\u00e2\u20ac\u2122s national poll was actually going up \n% towards the end of this election. This should have benefited Sink.\n% \n%% All politics is perhaps local\n% Actually, it is more important to see the local trend rather than the\n% national trend. So use the polls from Florida alone to see the local \n% Obama Job Approval trend.\n%\n% <<figure_03.png>>\n%\n% Obama's Job Approval was recovering at the national level, but his\n% approval was actually going down in Florida during this election. I am\n% wondering what was happening around the time that the undecideds suddenly\n% decided in the beginning of February.  But can you really say this was\n% the test of Obamacare?\n%\n% National news headlines around that time:\n% \n% * Philip Seymour Hoffman died\n% * Sochi Olympics coverage\n% * Farm bill passing Senate\n% * House approved debt limit ceiling hike\n% \n% Let me know if you have good data sources to test this claim. In my \n% opinion, Obamacare alone doesn't seem to fully explain this rapid shift.\n%\n%% MATLAB example with Pollster API and JSONlab\n% Now I would like to address the programming aspect of this post.\n% <http:\/\/elections.huffingtonpost.com\/pollster\/api Pollster API> provides\n% convenient access to the data from election polls. There are other\n% websites that aggregate election polls; this API was the easiest to use.\n% JSON is a popular format for web services like this, and you can install\n% an appropriate library from the FileExchange to process it. My favorite\n% is\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/33381-jsonlab--a-toolbox-to-encode-decode-json-files\n% JSONlab by Qianqian Fang>.\n%\n% Let\u00e2\u20ac\u2122s start out with an simple example of getting data for Obama \n% Job Approval Ratings.\n\nbaseUrl='http:\/\/elections.huffingtonpost.com\/pollster\/api\/charts';\nslug = 'obama-job-approval';\nrespFormat = 'json';\nfullUrl = sprintf('%s\/%s.%s',baseUrl,slug,respFormat);\n\n% add jsonlab to the search path\naddpath jsonlab;\n% get the poll data\ndata=loadjson(urlread(fullUrl));\n\n%% Convert the data into a table\n% JSON stores data in a nested tree structure like XML, so we need to\n% convert it into a table in order to use the data in MATLAB.\n% <https:\/\/www.mathworks.com\/help\/matlab\/tables.html |table|> is a new\n% feature introduced in R2013b that I like quite a lot.\n\n% initialize variables\nestimates=data.estimates_by_date;\ndate = zeros(length(estimates),1);\napprove = zeros(length(estimates),1);\ndisapprove = zeros(length(estimates),1);\nundecided = zeros(length(estimates),1);\n\n% loop over JSON tree\nfor i = 1:length(estimates)\n    date(i) = datenum(estimates{i}.date);\n    for j = 1:length(estimates{i}.estimates)\n        if strcmpi('approve',estimates{i}.estimates{j}.choice)\n            approve(i) = estimates{i}.estimates{j}.value;\n        elseif strcmpi('disapprove',estimates{i}.estimates{j}.choice)\n            disapprove(i) = estimates{i}.estimates{j}.value;\n        else\n            undecided(i) = estimates{i}.estimates{j}.value;\n        end\n    end\nend\n\n% consolidate the data into a table\nestimates = table(date,approve,disapprove,undecided);\ndisp(estimates(1:5,:))\n\n%% Remove missing values\n% Real data is never perfect, so we need to check for missing values and \n% remove affected rows.\n\n% get the indices of zero values\nisMissing = table2array(estimates) == 0;\n% get the count of missing values by variable\ndisp('number of missing values by variable')\ndisp(array2table(sum(isMissing),'VariableNames',estimates.Properties.VariableNames));\nobamaDecided = estimates(~(isMissing(:,2) | isMissing(:,3)),1:3);\nobamaUndecided = estimates(~isMissing(:,4),[1 4]);\n\n%% Plotting Obama Job Approval\n% In the final step, let's validate the data processing so far by plotting \n% the data and compare it to the chart on Pollster website.\n%\n% <html>\n% <script type=\"text\/javascript\" \n% src=\"http:\/\/elections.huffingtonpost.com\/pollster\/obama-job-approval\/embed.js#!maxdate=2014-03-29&estimate=official\" \n% data-width=\"580\" data-height=\"400\"><\/script>\n% <\/html>\n\nfigure\nplot(obamaDecided.date,obamaDecided.approve,'k-','LineWidth',2)\nhold on\nplot(obamaDecided.date,obamaDecided.disapprove,'r-','LineWidth',2)\nh = plot(obamaUndecided.date,obamaUndecided.undecided,'b-','LineWidth',2);\nset(h, 'color', [0.7 0.7 0.7])\ndatetick\nxlabel('Date')\nylabel('Estimate')\nlegend('Approve','Dispprove','Undecided','Location','East')\ntitle(data.title)\nxlim([datenum('2009-01-01') Inf])\nhold off\n\n%% Automate the process with object oriented programming\n% As you can see, this is an iterative process, so it is a good idea to\n% automate some of the steps. Let\u00e2\u20ac\u2122s use\n% <https:\/\/www.mathworks.com\/discovery\/object-oriented-programming.html\n% object oriented programming> to facilitate the data pull using a custom\n% class called <https:\/\/blogs.mathworks.com\/images\/loren\/2014TaxCode\/myPollster.m |myPollster|>. This way, all the processed\n% data is encapsulated in the object itself, and you don\u00e2\u20ac\u2122t run into\n% namespace issues.\n%\n% The |myPollster| class also provides a utility method to return the\n% logical indices of missing values in the table.\n\n% instantiate the object\nFL13 = myPollster();\n% specify the slug for the data pull\nslug = '2014-florida-house-13th-district-special-election';\n% call the API and store the result in the object.\nFL13.getChartData(slug);\n% check the result\ndisp(FL13.title)\ndisp(FL13.T(1:5,:))\n\n% Check for missing values\ndisp('check which variable contains missing values...')\ndisp(array2table(sum(FL13.isMissing),'VariableNames',FL13.T.Properties.VariableNames))\n\n%% Have I whetted your appetite?\n% Hopefully this simple example was sufficient to get you interested in \n% trying it yourself. In this example, I simply took the smoothed trend \n% lines provided by Pollster, but you could also get individual poll \n% data and build more complex model to make some prediction yourself.\n%\n% Toshi\n\n\n##### SOURCE END ##### 80859847a3ba4d7186d46b23117fe3b2\n-->\n","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/images\/loren\/2014\/ElectionPollAnalysis_01.png\" onError=\"this.style.display ='none';\" \/><\/div><!--introduction--><p>This is a mid-term election year here in the United States, and today's guest blogger, Toshi Takeuchi, invites you to try election poll analysis with MATLAB for fun.... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/loren\/2014\/04\/25\/election-poll-analysis-in-matlab\/\">read more >><\/a><\/p>","protected":false},"author":39,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[62,33,61],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/posts\/884"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/users\/39"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/comments?post=884"}],"version-history":[{"count":13,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/posts\/884\/revisions"}],"predecessor-version":[{"id":1986,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/posts\/884\/revisions\/1986"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/media?parent=884"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/categories?post=884"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/tags?post=884"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}