<p><div><div><div><div data-width="100" data-show-faces="false" data-send="true" data-layout="button_count" data-height="21" data-href="https://www.r-bloggers.com/deck-on-an-authorial-analysis-of-the-prime-ministers-speeches/"></div></div><div><a data-url="https://www.r-bloggers.com/deck-on-an-authorial-analysis-of-the-prime-ministers-speeches/" data-counturl="https://www.r-bloggers.com/deck-on-an-authorial-analysis-of-the-prime-ministers-speeches/" data-count="horizontal" data-text="Deck on an Authorial Analysis of the Prime Minister’s Speeches" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://aliarsalankazmi.github.io/posts/r/2016/11/26/deck_authorial_analysis.html"> R</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>I recently attempted a Stylistic Analysis of the Pakistani Prime Minister’s speeches, in order to identify if his speeches exhibit different Stylistic patterns. Large differences would indicate possibilities of different writers.</p>
<p>Background to this task: Some significant events in Pakistan had prompted the Prime Minister to address the nation. The speech was later leaked on Social Media, and supposedly presented the Prime Minister as discussing diction for his speech with his special aides.<br>
This was met with criticism by some Paksitani News Channels, which felt that at a time when the government is embroiled in corruption and mismanagement, the attitude depicted in the leaked clip is irresponsible.</p>
<p>The <a target="_blank" rel="nofollow" href="https://aliarsalankazmi.github.io/Deck-on-Analysis-of-the-PM-s-speeches/index.html#1">deck</a> linked to, summarises this task I took upon myself.<br>
The original post can be accessed from <a target="_blank" rel="nofollow" href="http://aliarsalankazmi.github.io/blog_DA/posts/r/2016/11/18/authorial_analysis_pm.html">here</a>.</p>
<p>The code that goes into this deck is presented below.</p>
<pre>---
---
title       : How Many Writers does the Prime Minister have for his Speeches?
subtitle    : An Authorial Analysis
author      : Ali Arsalan Kazmi
job         : 
framework   : io2012        # {io2012, html5slides, shower, dzslides, ...}
highlighter : highlight.js  # {highlight.js, prettify, highlight}
hitheme     : tomorrow      # 
widgets     : []            # {mathjax, quiz, bootstrap}
mode        : selfcontained # {standalone, draft}
knit        : slidify::knit2slides
--- .break

## Background

--- &amp;vcenter

A series of events in Pakistan prompted the Prime Minister to address the nation...



--- bg:url(http://blogs.reuters.com/great-debate/files/2013/10/pm-sharif.jpg);background-size:cover

<span>After the speech, however, an Audio clip was leaked, allegedly of the PM taking advice on diction from his aides</span>

---

## Surprise &amp; Criticism
   

![](http://www.northeastern.edu/careers/wp-content/uploads/2014/07/social-media.jpg)


--- &amp;vcenter

This was followed by another major event...

--- bg:url(https://cdn1.tnwcdn.com/wp-content/blogs.dir/1/files/2016/04/mossackfonseca-1100x735.jpg);background-size:cover


--- &amp;vcenter

Another speech was delivered...

--- &amp;vcenter 

And an Audio clip supposedly for this speech was also leaked...

---

## Questions asked in News Channels &amp; Social Media

>- Does the Prime Minister consult his advisors on diction for every speech or for ones delivered during extraordinary circumstances only?  
>- From his advisors, does the PM rely more on his family members?  
>- Has the PM's reliance on certain family members and aides increased only recently, as his government has come under increasing fire for involvement in large scale corruption?  
>- Is it possible to obtain information of such collaborations for other speeches of the PM?


--- .break

## Motivation

--- bg:url(https://thedailychapter.files.wordpress.com/2012/01/hand-writing-quill-pen.jpg);background-size:cover

--- 

<br>
<br>
<br>
Using Traditional Journalism to identify if different authors are involved in the PM's speeches is likely to be:  
>- perilous
>- time-consuming

Data Journalism, on the other hand, can attempt to answer this question relatively comfortably with:  
>- Stylistic Analysis/<a target="_blank" rel="nofollow" href="https://en.wikipedia.org/wiki/Stylometry">Stylometry</a>

--- .break

## Procedure

--- 

<br>
<br> 

>- Scrap Speech Data from the <a target="_blank" rel="nofollow" href="http://pmo.gov.pk/pm_speeches.php">PM Office's website</a>
    - English Speeches
    - Around 60 in total
>- Clean Data
    - Semi-automatic
>- Apply Stylometric Techniques
    - Various
    - <a target="_blank" rel="nofollow" href="https://sites.google.com/site/computationalstylistics/projects/testing-consensus-networks">Boostrap Consensus Network</a> (due to Professor <a target="_blank" rel="nofollow" href="https://sites.google.com/site/computationalstylistics/home">Eder</a>)
    - Visualise
>- Details included <a target="_blank" rel="nofollow" href="http://aliarsalankazmi.github.io/blog_DA/posts/r/2016/11/18/authorial_analysis_pm.html">here</a>

--- .break

## Datasets

---

## Datasets

Different datasets genereted using:

>- Parts of Speech (POS) Tagging
>- Word Bigrams
>- Character 4-grams


--- .break

### Bootstrap Consensus Network using POS Bigrams

---

![](http://aliarsalankazmi.github.io/blog_DA/assets/img/bcn_pos2a_small.png)

--- .break

### Heatmap using Most Frequent Word Bigrams

--- 
![](http://aliarsalankazmi.github.io/blog_DA/assets/img/heatmap_mfwbi_1_slide.png)


--- .break

### Bootstrap Consensus Network using Most Frequent Character 4-grams

--- 
![](http://aliarsalankazmi.github.io/blog_DA/assets/img/bcn_char4g_1.png)


---

## Two Authors?

<br>

>- Almost all analyses point to two separated clusters of speeches
>- Does depend significantly on amount of data
>- Indicates there may be two (or more) authors
>- Blog post can be accessed <a target="_blank" rel="nofollow" href="http://aliarsalankazmi.github.io/blog_DA/posts/r/2016/11/18/authorial_analysis_pm.html">here</a>


---</pre>
<p><div><div><div><div data-width="55" data-show-faces="false" data-send="true" data-layout="box_count" data-height="62" data-href="https://www.r-bloggers.com/deck-on-an-authorial-analysis-of-the-prime-ministers-speeches/"></div></div><div><a data-url="https://www.r-bloggers.com/deck-on-an-authorial-analysis-of-the-prime-ministers-speeches/" data-counturl="https://www.r-bloggers.com/deck-on-an-authorial-analysis-of-the-prime-ministers-speeches/" data-count="vertical" data-text="Deck on an Authorial Analysis of the Prime Minister’s Speeches" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://aliarsalankazmi.github.io/posts/r/2016/11/26/deck_authorial_analysis.html"> R</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" rel="nofollow" href="https://www.r-project.org/">R</a> news and <a title="R tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="https://www.r-bloggers.com/?s=data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="https://www.r-bloggers.com/?s=Big%20Data">Big Data, <a title="R jobs" rel="nofollow" href="https://www.r-users.com/">R jobs</a>, visualization (<a title="ggplot and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="https://www.r-bloggers.com/?s=map">maps</a>, <a title="Animation in R" rel="nofollow" href="https://www.r-bloggers.com/?s=animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="https://www.r-bloggers.com/?s=RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="https://www.r-bloggers.com/?s=sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="https://www.r-bloggers.com/?s=LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="https://www.r-bloggers.com/?s=SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="https://www.r-bloggers.com/?s=eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="https://www.r-bloggers.com/?s=git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="https://www.r-bloggers.com/?s=hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="https://www.r-bloggers.com/?s=Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="https://www.r-bloggers.com/?s=PCA">PCA</a>, <a title="Time series" rel="nofollow" href="https://www.r-bloggers.com/?s=time+series">time series</a>, <a title="finance trading" rel="nofollow" href="https://www.r-bloggers.com/?s=trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/cDs-APqozZI"></a></div>