<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta charset="utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="pandoc" />


<meta name="author" content="Yuxin Zou" />


<title>Presidential address-Flash</title>

<script src="site_libs/jquery-1.11.3/jquery.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="site_libs/bootstrap-3.3.5/css/cosmo.min.css" rel="stylesheet" />
<script src="site_libs/bootstrap-3.3.5/js/bootstrap.min.js"></script>
<script src="site_libs/bootstrap-3.3.5/shim/html5shiv.min.js"></script>
<script src="site_libs/bootstrap-3.3.5/shim/respond.min.js"></script>
<script src="site_libs/jqueryui-1.11.4/jquery-ui.min.js"></script>
<link href="site_libs/tocify-1.9.1/jquery.tocify.css" rel="stylesheet" />
<script src="site_libs/tocify-1.9.1/jquery.tocify.js"></script>
<script src="site_libs/navigation-1.1/tabsets.js"></script>
<script src="site_libs/navigation-1.1/codefolding.js"></script>
<link href="site_libs/highlightjs-9.12.0/textmate.css" rel="stylesheet" />
<script src="site_libs/highlightjs-9.12.0/highlight.js"></script>
<link href="site_libs/font-awesome-4.5.0/css/font-awesome.min.css" rel="stylesheet" />

<style type="text/css">code{white-space: pre;}</style>
<style type="text/css">
  pre:not([class]) {
    background-color: white;
  }
</style>
<script type="text/javascript">
if (window.hljs) {
  hljs.configure({languages: []});
  hljs.initHighlightingOnLoad();
  if (document.readyState && document.readyState === "complete") {
    window.setTimeout(function() { hljs.initHighlighting(); }, 0);
  }
}
</script>



<style type="text/css">
h1 {
  font-size: 34px;
}
h1.title {
  font-size: 38px;
}
h2 {
  font-size: 30px;
}
h3 {
  font-size: 24px;
}
h4 {
  font-size: 18px;
}
h5 {
  font-size: 16px;
}
h6 {
  font-size: 12px;
}
.table th:not([align]) {
  text-align: left;
}
</style>


</head>

<body>

<style type = "text/css">
.main-container {
  max-width: 940px;
  margin-left: auto;
  margin-right: auto;
}
code {
  color: inherit;
  background-color: rgba(0, 0, 0, 0.04);
}
img {
  max-width:100%;
  height: auto;
}
.tabbed-pane {
  padding-top: 12px;
}
button.code-folding-btn:focus {
  outline: none;
}
</style>


<style type="text/css">
/* padding for bootstrap navbar */
body {
  padding-top: 51px;
  padding-bottom: 40px;
}
/* offset scroll position for anchor links (for fixed navbar)  */
.section h1 {
  padding-top: 56px;
  margin-top: -56px;
}

.section h2 {
  padding-top: 56px;
  margin-top: -56px;
}
.section h3 {
  padding-top: 56px;
  margin-top: -56px;
}
.section h4 {
  padding-top: 56px;
  margin-top: -56px;
}
.section h5 {
  padding-top: 56px;
  margin-top: -56px;
}
.section h6 {
  padding-top: 56px;
  margin-top: -56px;
}
</style>

<script>
// manage active state of menu based on current page
$(document).ready(function () {
  // active menu anchor
  href = window.location.pathname
  href = href.substr(href.lastIndexOf('/') + 1)
  if (href === "")
    href = "index.html";
  var menuAnchor = $('a[href="' + href + '"]');

  // mark it active
  menuAnchor.parent().addClass('active');

  // if it's got a parent navbar menu mark it active as well
  menuAnchor.closest('li.dropdown').addClass('active');
});
</script>


<div class="container-fluid main-container">

<!-- tabsets -->
<script>
$(document).ready(function () {
  window.buildTabsets("TOC");
});
</script>

<!-- code folding -->
<style type="text/css">
.code-folding-btn { margin-bottom: 4px; }
</style>
<script>
$(document).ready(function () {
  window.initializeCodeFolding("hide" === "show");
});
</script>




<script>
$(document).ready(function ()  {

    // move toc-ignore selectors from section div to header
    $('div.section.toc-ignore')
        .removeClass('toc-ignore')
        .children('h1,h2,h3,h4,h5').addClass('toc-ignore');

    // establish options
    var options = {
      selectors: "h1,h2,h3",
      theme: "bootstrap3",
      context: '.toc-content',
      hashGenerator: function (text) {
        return text.replace(/[.\\/?&!#<>]/g, '').replace(/\s/g, '_').toLowerCase();
      },
      ignoreSelector: ".toc-ignore",
      scrollTo: 0
    };
    options.showAndHide = true;
    options.smoothScroll = true;

    // tocify
    var toc = $("#TOC").tocify(options).data("toc-tocify");
});
</script>

<style type="text/css">

#TOC {
  margin: 25px 0px 20px 0px;
}
@media (max-width: 768px) {
#TOC {
  position: relative;
  width: 100%;
}
}


.toc-content {
  padding-left: 30px;
  padding-right: 40px;
}

div.main-container {
  max-width: 1200px;
}

div.tocify {
  width: 20%;
  max-width: 260px;
  max-height: 85%;
}

@media (min-width: 768px) and (max-width: 991px) {
  div.tocify {
    width: 25%;
  }
}

@media (max-width: 767px) {
  div.tocify {
    width: 100%;
    max-width: none;
  }
}

.tocify ul, .tocify li {
  line-height: 20px;
}

.tocify-subheader .tocify-item {
  font-size: 0.90em;
  padding-left: 25px;
  text-indent: 0;
}

.tocify .list-group-item {
  border-radius: 0px;
}


</style>

<!-- setup 3col/9col grid for toc_float and main content  -->
<div class="row-fluid">
<div class="col-xs-12 col-sm-4 col-md-3">
<div id="TOC" class="tocify">
</div>
</div>

<div class="toc-content col-xs-12 col-sm-8 col-md-9">




<div class="navbar navbar-default  navbar-fixed-top" role="navigation">
  <div class="container">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar">
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="index.html">mash_application</a>
    </div>
    <div id="navbar" class="navbar-collapse collapse">
      <ul class="nav navbar-nav">
        <li>
  <a href="index.html">Home</a>
</li>
<li>
  <a href="about.html">About</a>
</li>
<li>
  <a href="license.html">License</a>
</li>
      </ul>
      <ul class="nav navbar-nav navbar-right">
        <li>
  <a href="https://github.com/jdblischak/workflowr">
    <span class="fa fa-github"></span>
     
  </a>
</li>
      </ul>
    </div><!--/.nav-collapse -->
  </div><!--/.container -->
</div><!--/.navbar -->
<!-- Add a small amount of space between sections. -->
<style type="text/css">
div.section {
  padding-top: 12px;
}
</style>

<div class="fluid-row" id="header">

<div class="btn-group pull-right">
<button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span>Code</span> <span class="caret"></span></button>
<ul class="dropdown-menu" style="min-width: 50px;">
<li><a id="rmd-show-all-code" href="#">Show All Code</a></li>
<li><a id="rmd-hide-all-code" href="#">Hide All Code</a></li>
</ul>
</div>



<h1 class="title toc-ignore">Presidential address-Flash</h1>
<h4 class="author"><em>Yuxin Zou</em></h4>
<h4 class="date"><em>2018-2-21</em></h4>

</div>


<!-- Update knitr chunk options -->
<!-- Insert the date the file was last updated -->
<p><strong>Last updated:</strong> 2018-03-08</p>
<!-- Insert the code version (Git commit SHA1) if Git repository exists and R
 package git2r is installed -->
<p><strong>Code version:</strong> 7bd0159</p>
<pre class="r"><code>library(flashr); library(R.matlab)</code></pre>
<pre><code>R.matlab v3.6.1 (2016-10-19) successfully loaded. See ?R.matlab for help.</code></pre>
<pre><code>
Attaching package: &#39;R.matlab&#39;</code></pre>
<pre><code>The following objects are masked from &#39;package:base&#39;:

    getOption, isOpen</code></pre>
<pre class="r"><code>library(denoiseR)</code></pre>
<p>Presidential Address data:</p>
<p>The data contains word counts from the inaugural addresses of 13 US presidents (1940–2009). There are 13 rows (presidents) and 836 columns (words), and each entry indicates the number of times a particular word was used in a particular address. Since both row and column means vary greatly here we pre-processed the data by centering and scaling both rows and columns, using the biScale function from softImpute.</p>
<pre class="r"><code>data(&quot;Presidents&quot;)
data = readMat(&#39;../data/PresiAdd.mat&#39;)
data = data$Yscaled
words = row.names(Presidents)
names = colnames(Presidents)
row.names(data) = names
colnames(data) = words</code></pre>
<p>Flash:</p>
<pre class="r"><code>flash.data = flash_set_data(data)
fmodel = flash(flash.data, greedy = TRUE, backfit = TRUE)</code></pre>
<pre><code>fitting factor/loading 1</code></pre>
<pre><code>fitting factor/loading 2</code></pre>
<pre><code>fitting factor/loading 3</code></pre>
<pre><code>fitting factor/loading 4</code></pre>
<pre><code>fitting factor/loading 5</code></pre>
<pre><code>fitting factor/loading 6</code></pre>
<pre class="r"><code>saveRDS(fmodel, &#39;../output/PresiAddVarCol.rds&#39;)</code></pre>
<pre class="r"><code>Factors = flash_get_ldf(fmodel)$f
row.names(Factors) = words
pve.order = order(flash_get_pve(fmodel), decreasing = TRUE)</code></pre>
<pre class="r"><code>par(mar=c(1,1,1,1))
par(mfrow=c(3,2))
for(i in pve.order){
  barplot(Factors[,i], main=paste0(&#39;Factor &#39;,i, &#39; pve= &#39;, round(flash_get_pve(fmodel)[i],3)), las=2, names=&#39;&#39;)
}
par(mfrow=c(1,1))</code></pre>
<p><img src="figure/Flash_PresiAdd.Rmd/unnamed-chunk-7-1.png" width="672" style="display: block; margin: auto;" /></p>
<p>Flash again on the loading matrix</p>
<pre class="r"><code>flash.loading = flash_set_data(fmodel$EL[,1:5])
flmodel = flash(flash.loading, greedy = TRUE, backfit = TRUE)</code></pre>
<pre><code>fitting factor/loading 1</code></pre>
<pre><code>fitting factor/loading 2</code></pre>
<pre class="r"><code>Factors_loading = flash_get_ldf(flmodel)$f</code></pre>
<pre class="r"><code>barplot(as.numeric(Factors_loading), main=paste0(&#39;Factor 1 pve= &#39;, round(flash_get_pve(flmodel),3)), las=2, cex.names = 0.4, names=&#39;&#39;)</code></pre>
<p><img src="figure/Flash_PresiAdd.Rmd/unnamed-chunk-10-1.png" width="672" style="display: block; margin: auto;" /></p>
<p>The distributions for the first four columns of the loading matrix are consistent with a normal distribution. So they are captured by the error term of the second flash run.</p>
<p>We check the strongest words in each factor.</p>
<p>The first factor separates the words about Iraq from those very general political words.</p>
<pre class="r"><code># Factor 1
words[order(Factors[,1], decreasing = TRUE)[1:50]]</code></pre>
<pre><code> [1] &quot;Iraq&quot;        &quot;critical&quot;    &quot;away &quot;       &quot;tomorrow&quot;    &quot;depend &quot;    
 [6] &quot;bad  &quot;       &quot;play &quot;       &quot;whatever&quot;    &quot;guarantee  &quot; &quot;simply &quot;    
[11] &quot;longer &quot;     &quot;hear &quot;       &quot;partner&quot;     &quot;often&quot;       &quot;road &quot;      
[16] &quot;era  &quot;       &quot;responsible&quot; &quot;plant&quot;       &quot;recession  &quot; &quot;easy &quot;      
[21] &quot;least&quot;       &quot;avoid&quot;       &quot;deep &quot;       &quot;happen &quot;     &quot;view &quot;      
[26] &quot;agree&quot;       &quot;vice &quot;       &quot;building&quot;    &quot;lay  &quot;       &quot;solve&quot;      
[31] &quot;launch &quot;     &quot;reward &quot;     &quot;fundamental&quot; &quot;$1&quot;          &quot;contribute &quot;
[36] &quot;rule &quot;       &quot;week &quot;       &quot;fulfill&quot;     &quot;election&quot;    &quot;0&quot;          
[41] &quot;competitive&quot; &quot;tough&quot;       &quot;big  &quot;       &quot;street &quot;     &quot;burden &quot;    
[46] &quot;moral&quot;       &quot;soon &quot;       &quot;speed&quot;       &quot;powerful&quot;    &quot;simple &quot;    </code></pre>
<pre class="r"><code>words[order(Factors[,1])[1:50]]</code></pre>
<pre><code> [1] &quot;have &quot;       &quot;be&quot;          &quot;to&quot;          &quot;need &quot;       &quot;make &quot;      
 [6] &quot;as&quot;          &quot;can  &quot;       &quot;state&quot;       &quot;service&quot;     &quot;most &quot;      
[11] &quot;government &quot; &quot;force&quot;       &quot;continue&quot;    &quot;world&quot;       &quot;nation &quot;    
[16] &quot;year &quot;       &quot;other&quot;       &quot;will &quot;       &quot;increase&quot;    &quot;people &quot;    
[21] &quot;congress&quot;    &quot;peace&quot;       &quot;provide&quot;     &quot;national&quot;    &quot;unite&quot;      
[26] &quot;would&quot;       &quot;use  &quot;       &quot;system &quot;     &quot;private&quot;     &quot;program&quot;    
[31] &quot;meet &quot;       &quot;must &quot;       &quot;now  &quot;       &quot;also &quot;       &quot;progress&quot;   
[36] &quot;security&quot;    &quot;great&quot;       &quot;policy &quot;     &quot;high &quot;       &quot;legislation&quot;
[41] &quot;action &quot;     &quot;good &quot;       &quot;not  &quot;       &quot;only &quot;       &quot;important  &quot;
[46] &quot;economic&quot;    &quot;public &quot;     &quot;first&quot;       &quot;law  &quot;       &quot;past &quot;      </code></pre>
<p>The second factor separates the words about people’s life, like ‘child’, ‘job’, ‘school’, ‘parent’, ‘Medicare’, from political words.</p>
<pre class="r"><code># Factor 2
words[order(Factors[,2], decreasing = TRUE)[1:50]]</code></pre>
<pre><code> [1] &quot;thus &quot;         &quot;complete&quot;      &quot;affair &quot;       &quot;executive  &quot;  
 [5] &quot;adequate&quot;      &quot;particularly &quot; &quot;importance &quot;   &quot;agricultural &quot;
 [9] &quot;facility&quot;      &quot;understanding&quot; &quot;western&quot;       &quot;demonstrate&quot;  
[13] &quot;situation  &quot;   &quot;activity&quot;      &quot;assure &quot;       &quot;capacity&quot;     
[17] &quot;substantial&quot;   &quot;agriculture&quot;   &quot;available  &quot;   &quot;improvement&quot;  
[21] &quot;objective  &quot;   &quot;republic&quot;      &quot;natural&quot;       &quot;period &quot;      
[25] &quot;legislative&quot;   &quot;rapidly&quot;       &quot;provision  &quot;   &quot;cooperation&quot;  
[29] &quot;maintain&quot;      &quot;design &quot;       &quot;requirement&quot;   &quot;general&quot;      
[33] &quot;basis&quot;         &quot;assist &quot;       &quot;structure  &quot;   &quot;resource&quot;     
[37] &quot;position&quot;      &quot;political  &quot;   &quot;relation&quot;      &quot;i&quot;            
[41] &quot;clearly&quot;       &quot;vast &quot;         &quot;appropriate&quot;   &quot;farm &quot;        
[45] &quot;contribution &quot; &quot;exist&quot;         &quot;being&quot;         &quot;addition&quot;     
[49] &quot;industrial &quot;   &quot;organization &quot;</code></pre>
<pre class="r"><code>words[order(Factors[,2])[1:50]]</code></pre>
<pre><code> [1] &quot;safe &quot;    &quot;thank&quot;    &quot;child&quot;    &quot;join &quot;    &quot;pass &quot;    &quot;ask  &quot;   
 [7] &quot;here &quot;    &quot;america&quot;  &quot;save &quot;    &quot;get  &quot;    &quot;family &quot;  &quot;sure &quot;   
[13] &quot;young&quot;    &quot;fellow &quot;  &quot;American&quot; &quot;job  &quot;    &quot;who  &quot;    &quot;say  &quot;   
[19] &quot;just &quot;    &quot;start&quot;    &quot;lead &quot;    &quot;know &quot;    &quot;n&quot;        &quot;tonight&quot; 
[25] &quot;stop &quot;    &quot;when &quot;    &quot;leave&quot;    &quot;parent &quot;  &quot;back &quot;    &quot;together&quot;
[31] &quot;America&quot;  &quot;money&quot;    &quot;so&quot;       &quot;honor&quot;    &quot;next &quot;    &quot;let  &quot;   
[37] &quot;do&quot;       &quot;begin&quot;    &quot;school &quot;  &quot;reform &quot;  &quot;go&quot;       &quot;create &quot; 
[43] &quot;cut  &quot;    &quot;worker &quot;  &quot;day  &quot;    &quot;keep &quot;    &quot;t&quot;        &quot;down &quot;   
[49] &quot;help &quot;    &quot;bill &quot;   </code></pre>
<p>The third factor separate the words about government and development of technology. These words are used in Carter’s address.</p>
<pre class="r"><code># Factor 3
words[order(Factors[,3], decreasing = TRUE)[1:50]]</code></pre>
<pre><code> [1] &quot;win  &quot;       &quot;may  &quot;       &quot;method &quot;     &quot;destroy&quot;     &quot;man  &quot;      
 [6] &quot;point&quot;       &quot;whole&quot;       &quot;war  &quot;       &quot;fact &quot;       &quot;find &quot;      
[11] &quot;power&quot;       &quot;practice&quot;    &quot;follow &quot;     &quot;few  &quot;       &quot;victory&quot;    
[16] &quot;army &quot;       &quot;great&quot;       &quot;far  &quot;       &quot;shall&quot;       &quot;modern &quot;    
[21] &quot;history&quot;     &quot;labor&quot;       &quot;lie  &quot;       &quot;possible&quot;    &quot;case &quot;      
[26] &quot;rest &quot;       &quot;not  &quot;       &quot;produce&quot;     &quot;certain&quot;     &quot;immediate  &quot;
[31] &quot;learn&quot;       &quot;accept &quot;     &quot;fight&quot;       &quot;live &quot;       &quot;carry&quot;      
[36] &quot;fear &quot;       &quot;adequate&quot;    &quot;beginning  &quot; &quot;would&quot;       &quot;ahead&quot;      
[41] &quot;mean &quot;       &quot;total&quot;       &quot;condition  &quot; &quot;operation  &quot; &quot;fail &quot;      
[46] &quot;back &quot;       &quot;believe&quot;     &quot;session&quot;     &quot;task &quot;       &quot;part &quot;      </code></pre>
<pre class="r"><code>words[order(Factors[,3])[1:50]]</code></pre>
<pre><code> [1] &quot;administration &quot; &quot;remain &quot;         &quot;stability  &quot;    
 [4] &quot;develop&quot;         &quot;area &quot;           &quot;major&quot;          
 [7] &quot;assistance &quot;     &quot;promote&quot;         &quot;nuclear&quot;        
[10] &quot;significant&quot;     &quot;sector &quot;         &quot;relation&quot;       
[13] &quot;strong &quot;         &quot;establish  &quot;     &quot;comprehensive&quot;  
[16] &quot;demonstrate&quot;     &quot;conservation &quot;   &quot;sign &quot;          
[19] &quot;negotiation&quot;     &quot;system &quot;         &quot;technology &quot;    
[22] &quot;agreement  &quot;     &quot;development&quot;     &quot;political  &quot;    
[25] &quot;strategic  &quot;     &quot;ensure &quot;         &quot;serious&quot;        
[28] &quot;support&quot;         &quot;policy &quot;         &quot;agency &quot;        
[31] &quot;important  &quot;     &quot;energy &quot;         &quot;soviet &quot;        
[34] &quot;provide&quot;         &quot;region &quot;         &quot;continue&quot;       
[37] &quot;oil  &quot;           &quot;foundation &quot;     &quot;importance &quot;    
[40] &quot;improve&quot;         &quot;encourage  &quot;     &quot;commitment &quot;    
[43] &quot;western&quot;         &quot;funding&quot;         &quot;access &quot;        
[46] &quot;global &quot;         &quot;addition&quot;        &quot;rural&quot;          
[49] &quot;stable &quot;         &quot;assist &quot;        </code></pre>
<p>The fourth factor separate the words about Vietnam war.</p>
<pre class="r"><code># Factor 4
words[order(Factors[,4], decreasing = TRUE)[1:50]]</code></pre>
<pre><code> [1] &quot;session&quot;         &quot;history&quot;         &quot;chance &quot;        
 [4] &quot;Vietnam&quot;         &quot;poverty&quot;         &quot;senate &quot;        
 [7] &quot;south&quot;           &quot;goal &quot;           &quot;entire &quot;        
[10] &quot;achievement&quot;     &quot;open &quot;           &quot;land &quot;          
[13] &quot;city &quot;           &quot;consumer&quot;        &quot;Asia &quot;          
[16] &quot;skill&quot;           &quot;quality&quot;         &quot;answer &quot;        
[19] &quot;water&quot;           &quot;deal &quot;           &quot;question&quot;       
[22] &quot;partnership&quot;     &quot;in&quot;              &quot;congress&quot;       
[25] &quot;then &quot;           &quot;enter&quot;           &quot;ahead&quot;          
[28] &quot;treaty &quot;         &quot;try  &quot;           &quot;structure  &quot;    
[31] &quot;reach&quot;           &quot;approve&quot;         &quot;believe&quot;        
[34] &quot;resolve&quot;         &quot;i&quot;               &quot;measure&quot;        
[37] &quot;last &quot;           &quot;move &quot;           &quot;test &quot;          
[40] &quot;crime&quot;           &quot;possible&quot;        &quot;assist &quot;        
[43] &quot;hospital&quot;        &quot;transportation &quot; &quot;pledge &quot;        
[46] &quot;live &quot;           &quot;revenue&quot;         &quot;early&quot;          
[49] &quot;truly&quot;           &quot;$1&quot;             </code></pre>
<pre class="r"><code>words[order(Factors[,4])[1:50]]</code></pre>
<pre><code> [1] &quot;general&quot;       &quot;operation  &quot;   &quot;practice&quot;      &quot;sound&quot;        
 [5] &quot;immediate  &quot;   &quot;such &quot;         &quot;production &quot;   &quot;permanent  &quot;  
 [9] &quot;situation  &quot;   &quot;number &quot;       &quot;industrial &quot;   &quot;fundamental&quot;  
[13] &quot;day  &quot;         &quot;whole&quot;         &quot;future &quot;       &quot;effect &quot;      
[17] &quot;ideal&quot;         &quot;investment &quot;   &quot;powerful&quot;      &quot;force&quot;        
[21] &quot;encourage  &quot;   &quot;plant&quot;         &quot;agricultural &quot; &quot;include&quot;      
[25] &quot;away &quot;         &quot;activity&quot;      &quot;group&quot;         &quot;exist&quot;        
[29] &quot;army &quot;         &quot;plan &quot;         &quot;certain&quot;       &quot;long &quot;        
[33] &quot;thing&quot;         &quot;condition  &quot;   &quot;rest &quot;         &quot;democratic &quot;  
[37] &quot;produce&quot;       &quot;term &quot;         &quot;process&quot;       &quot;objective  &quot;  
[41] &quot;fall &quot;         &quot;democracy  &quot;   &quot;put  &quot;         &quot;gain &quot;        
[45] &quot;capital&quot;       &quot;service&quot;       &quot;pay  &quot;         &quot;armed&quot;        
[49] &quot;economic&quot;      &quot;depend &quot;      </code></pre>
<p>The fifth factor separates words about Vietnam war from words like ‘peacetime’, ‘reform’.</p>
<pre class="r"><code># Factor 5
words[order(Factors[,5], decreasing = TRUE)[1:50]]</code></pre>
<pre><code> [1] &quot;look &quot;         &quot;place&quot;         &quot;truly&quot;         &quot;difference &quot;  
 [5] &quot;set  &quot;         &quot;chance &quot;       &quot;message&quot;       &quot;address&quot;      
 [9] &quot;washington &quot;   &quot;structure  &quot;   &quot;example&quot;       &quot;generation &quot;  
[13] &quot;particular &quot;   &quot;point&quot;         &quot;meet &quot;         &quot;environment&quot;  
[17] &quot;approach&quot;      &quot;peacetime  &quot;   &quot;beginning  &quot;   &quot;record &quot;      
[21] &quot;historic&quot;      &quot;critical&quot;      &quot;goal &quot;         &quot;million&quot;      
[25] &quot;decision&quot;      &quot;comprehensive&quot; &quot;america&quot;       &quot;open &quot;        
[29] &quot;preserve&quot;      &quot;government &quot;   &quot;concern&quot;       &quot;America&quot;      
[33] &quot;building&quot;      &quot;era  &quot;         &quot;great&quot;         &quot;priority&quot;     
[37] &quot;balanced&quot;      &quot;what &quot;         &quot;back &quot;         &quot;proposal&quot;     
[41] &quot;ahead&quot;         &quot;become &quot;       &quot;negotiation&quot;   &quot;same &quot;        
[45] &quot;natural&quot;       &quot;fundamental&quot;   &quot;relationship &quot; &quot;sense&quot;        
[49] &quot;reform &quot;       &quot;particularly &quot;</code></pre>
<pre class="r"><code>words[order(Factors[,5])[1:50]]</code></pre>
<pre><code> [1] &quot;south&quot;       &quot;north&quot;       &quot;poverty&quot;     &quot;test &quot;       &quot;month&quot;      
 [6] &quot;$1&quot;          &quot;carry&quot;       &quot;hospital&quot;    &quot;hope &quot;       &quot;especially &quot;
[11] &quot;early&quot;       &quot;danger &quot;     &quot;aggression &quot; &quot;public &quot;     &quot;seek &quot;      
[16] &quot;rest &quot;       &quot;payment&quot;     &quot;food &quot;       &quot;approve&quot;     &quot;europe &quot;    
[21] &quot;man  &quot;       &quot;try  &quot;       &quot;permit &quot;     &quot;Vietnam&quot;     &quot;prevent&quot;    
[26] &quot;prepare&quot;     &quot;find &quot;       &quot;unity&quot;       &quot;already&quot;     &quot;certain&quot;    
[31] &quot;entire &quot;     &quot;course &quot;     &quot;skill&quot;       &quot;close&quot;       &quot;home &quot;      
[36] &quot;in&quot;          &quot;last &quot;       &quot;effort &quot;     &quot;think&quot;       &quot;pledge &quot;    
[41] &quot;short&quot;       &quot;conflict&quot;    &quot;recommend  &quot; &quot;least&quot;       &quot;strengthen &quot;
[46] &quot;extend &quot;     &quot;finally&quot;     &quot;Iraq&quot;        &quot;achievement&quot; &quot;bear &quot;      </code></pre>
<p>Checking the loading matrix</p>
<pre class="r"><code>loading = fmodel$EL[,1:5]
row.names(loading) = names
loading</code></pre>
<pre><code>            [,1]        [,2]         [,3]         [,4]          [,5]
Roos  -11.749949   7.3625658  17.85384337 -12.95451443   0.018641829
Trum  -19.545564  10.6172584   5.84426524  -6.03364902  -0.025528893
Eise  -17.804700  13.7714467  -4.18405718  -4.34058236   0.022367090
Kenn   15.089515  13.3985343  -0.22487247  -0.03688365 -21.745118226
John   -2.471928  -0.7544205   6.48496963  26.92988948 -38.428225506
Nixo    9.068585   6.3107013   4.30658520  18.88490017  51.978743499
Ford   18.748130  11.3162886  -5.12464770  -4.16083773   0.016974278
Cart  -13.115567   7.1901043 -23.24710473   0.02551236   0.001341336
Reag   -5.423707 -17.3142106  -0.07000135  -0.11704529   7.122486088
Bush   18.904265  -6.6852742   0.07994342 -11.92173614  -0.004739630
Clin   -8.207371 -22.7657349  -0.01911699   0.11123080   0.075746403
Bushf  -4.507005 -18.7038114  -0.05075150  -0.12599003  -0.027001068
Obam   20.995769  -3.6126797  -0.01329787  -5.48368076  -0.033863230</code></pre>
<p>Kennedy, Johnson and Nixon used the words in Factor 5 a lot. This is reasonable since the Vietnam war was happened during their presidency term. When Nixon took office, people want peace because of the long times of the war. So he used words about ‘peace’ in his address a lot.</p>
<div id="session-information" class="section level1">
<h1>Session information</h1>
<!-- Insert the session information into the document -->
<pre class="r"><code>sessionInfo()</code></pre>
<pre><code>R version 3.4.3 (2017-11-30)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.3

Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] denoiseR_1.0   R.matlab_3.6.1 flashr_0.5-6  

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.15         compiler_3.4.3       git2r_0.20.0        
 [4] plyr_1.8.4           R.utils_2.6.0        R.methodsS3_1.7.1   
 [7] iterators_1.0.9      tools_3.4.3          digest_0.6.13       
[10] evaluate_0.10.1      tibble_1.3.4         gtable_0.2.0        
[13] lattice_0.20-35      rlang_0.1.6          Matrix_1.2-12       
[16] foreach_1.4.4        yaml_2.1.17          parallel_3.4.3      
[19] ebnm_0.1-10          cluster_2.0.6        stringr_1.3.0       
[22] knitr_1.20           flashClust_1.01-2    scatterplot3d_0.3-40
[25] rprojroot_1.2        grid_3.4.3           rmarkdown_1.8       
[28] irlba_2.3.2          FactoMineR_1.39      ggplot2_2.2.1       
[31] ashr_2.2-7           magrittr_1.5         leaps_3.0           
[34] backports_1.1.2      scales_0.5.0         codetools_0.2-15    
[37] htmltools_0.3.6      MASS_7.3-47          assertthat_0.2.0    
[40] softImpute_1.4       colorspace_1.3-2     stringi_1.1.6       
[43] lazyeval_0.2.1       pscl_1.5.2           doParallel_1.0.11   
[46] munsell_0.4.3        truncnorm_1.0-8      SQUAREM_2017.10-1   
[49] R.oo_1.21.0         </code></pre>
</div>

<!-- Adjust MathJax settings so that all math formulae are shown using
TeX fonts only; see
http://docs.mathjax.org/en/latest/configuration.html.  This will make
the presentation more consistent at the cost of the webpage sometimes
taking slightly longer to load. Note that this only works because the
footer is added to webpages before the MathJax javascript. -->
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    "HTML-CSS": { availableFonts: ["TeX"] }
  });
</script>

<hr>
<p>
    This <a href="http://rmarkdown.rstudio.com">R Markdown</a> site was created with <a href="https://github.com/jdblischak/workflowr">workflowr</a>
</p>
<hr>

<!-- To enable disqus, uncomment the section below and provide your disqus_shortname -->

<!-- disqus
  <div id="disqus_thread"></div>
    <script type="text/javascript">
        /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
        var disqus_shortname = 'rmarkdown'; // required: replace example with your forum shortname

        /* * * DON'T EDIT BELOW THIS LINE * * */
        (function() {
            var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
            dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
            (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
        })();
    </script>
    <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
    <a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
-->


</div>
</div>

</div>

<script>

// add bootstrap table styles to pandoc tables
function bootstrapStylePandocTables() {
  $('tr.header').parent('thead').parent('table').addClass('table table-condensed');
}
$(document).ready(function () {
  bootstrapStylePandocTables();
});


</script>

<!-- dynamically load mathjax for compatibility with self-contained -->
<script>
  (function () {
    var script = document.createElement("script");
    script.type = "text/javascript";
    script.src  = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
    document.getElementsByTagName("head")[0].appendChild(script);
  })();
</script>

</body>
</html>