{"id":359,"date":"2013-04-21T15:58:09","date_gmt":"2013-04-21T19:58:09","guid":{"rendered":"http:\/\/greiner.ca\/blog\/?p=359"},"modified":"2014-02-06T19:36:06","modified_gmt":"2014-02-07T00:36:06","slug":"using-correspondence-analysis-to-analyze-canadian-federal-budget-speeches-1966-2013","status":"publish","type":"post","link":"http:\/\/greiner.ca\/blog\/2013\/04\/21\/using-correspondence-analysis-to-analyze-canadian-federal-budget-speeches-1966-2013\/","title":{"rendered":"Using correspondence analysis to analyze Canadian federal budget speeches, 1966-2013"},"content":{"rendered":"<p>I&#8217;ve recently successfully completed at <strong><em>coursera.or<\/em>g<\/strong> in data analysis, and several courses that make use of the R language.\u00a0 Feeling flush with my new-found powers, I looked around for something to analyze, and the recent federal budget speech caught my attention.\u00a0 I created (and tweeted) a quick&amp;dirty word cloud picture of the budget &#8230; that&#8217;s a diagram created from the most popular words in a text document, with the size of the words proportional to how often that word is used.\u00a0 Real pretty, but pretty empty of quantitative usefulness.\u00a0 So I did a bit of research and discovered a rather nifty technique for analyzing textual documents, correspondence analysis.\u00a0 And thus began my decent into figuring out how to use this to analyze budget speeches, then a search for as many budget speeches as I could find (that took a while!).\u00a0 After tinkering with data and algorithms and code (oh, my!) I came up with some rather intriguing (to me, at least) results.\u00a0 Here&#8217;s the rather formal<\/p>\n<p><strong><span style=\"color: #ff0000;\"><a href=\"http:\/\/greiner.ca\/blog\/wp-content\/uploads\/2013\/04\/Using-Correspondence-Analysis-to-Analyze-Cdn-Federal-Budget-Speeches-1966-2013.pdf\"><span style=\"color: #ff0000;\">Using Correspondence Analysis to Analyze Cdn Federal Budget Speeches 1966-2013<\/span><\/a><\/span><\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>Here&#8217;s the data and code for the analysis :<\/p>\n<p><span style=\"color: #ff0000;\"><a href=\"http:\/\/greiner.ca\/blog\/wp-content\/uploads\/2013\/04\/CorrespondenceAnalysisPrograms.zip\"><span style=\"color: #ff0000;\">CorrespondenceAnalysisPrograms<\/span><\/a><\/span><\/p>\n<p><span style=\"color: #ff0000;\"><a href=\"http:\/\/greiner.ca\/blog\/wp-content\/uploads\/2013\/04\/Federal.zip\"><span style=\"color: #ff0000;\">Federal<\/span><\/a><\/span><\/p>\n<p>As a teaser (or for those of you who just want a pretty picture) here&#8217;s a diagram that summarizes the results.\u00a0 It&#8217;s amazing how much work goes on behind the scenes to produce a single pretty picture!\u00a0 To summarize, I analyzed each budget speech and reduced it to a set of numerical values (&#8220;dimensions&#8221;).\u00a0 This plot shows each budget speech plotted on a X-Y plot, showing how each varies in relation to all the others.\u00a0 Curiously, it shows how the budget speeches evolve over time (as opposed to random changes), and how the budgets tend to get tweaked for elections (surprise, surprise).<\/p>\n<p><a href=\"http:\/\/greiner.ca\/blog\/2013\/04\/21\/using-correspondence-analysis-to-analyze-canadian-federal-budget-speeches-1966-2013\/federal_ca_partycolours-2\/\" rel=\"attachment wp-att-367\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-367\" alt=\"Federal_CA_partycolours\" src=\"http:\/\/greiner.ca\/blog\/wp-content\/uploads\/2013\/04\/Federal_CA_partycolours.jpg\" width=\"2100\" height=\"2100\" srcset=\"http:\/\/greiner.ca\/blog\/wp-content\/uploads\/2013\/04\/Federal_CA_partycolours.jpg 2100w, http:\/\/greiner.ca\/blog\/wp-content\/uploads\/2013\/04\/Federal_CA_partycolours-150x150.jpg 150w, http:\/\/greiner.ca\/blog\/wp-content\/uploads\/2013\/04\/Federal_CA_partycolours-300x300.jpg 300w, http:\/\/greiner.ca\/blog\/wp-content\/uploads\/2013\/04\/Federal_CA_partycolours-1024x1024.jpg 1024w, http:\/\/greiner.ca\/blog\/wp-content\/uploads\/2013\/04\/Federal_CA_partycolours-400x400.jpg 400w\" sizes=\"auto, (max-width: 2100px) 100vw, 2100px\" \/><\/a><\/p>\n<p>Anyways, I had a LOT of fun playing around with this, and plan to do some more.\u00a0 Hope you enjoy it!<\/p>\n<p>&nbsp;<\/p>\n<p>[February 5\/14 &#8230; the links to the report and files got broken, but are now fixed]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve recently successfully completed at coursera.org in data analysis, and several courses that make use of the R language.\u00a0 Feeling flush with my new-found powers, I looked around for something to analyze, and the recent federal budget speech caught my &hellip; <a href=\"http:\/\/greiner.ca\/blog\/2013\/04\/21\/using-correspondence-analysis-to-analyze-canadian-federal-budget-speeches-1966-2013\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21,20],"tags":[23,22],"class_list":["post-359","post","type-post","status-publish","format-standard","hentry","category-data-analysis","category-r","tag-data-analysis","tag-r"],"_links":{"self":[{"href":"http:\/\/greiner.ca\/blog\/wp-json\/wp\/v2\/posts\/359","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/greiner.ca\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/greiner.ca\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/greiner.ca\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/greiner.ca\/blog\/wp-json\/wp\/v2\/comments?post=359"}],"version-history":[{"count":7,"href":"http:\/\/greiner.ca\/blog\/wp-json\/wp\/v2\/posts\/359\/revisions"}],"predecessor-version":[{"id":438,"href":"http:\/\/greiner.ca\/blog\/wp-json\/wp\/v2\/posts\/359\/revisions\/438"}],"wp:attachment":[{"href":"http:\/\/greiner.ca\/blog\/wp-json\/wp\/v2\/media?parent=359"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/greiner.ca\/blog\/wp-json\/wp\/v2\/categories?post=359"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/greiner.ca\/blog\/wp-json\/wp\/v2\/tags?post=359"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}