<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/plotting-trees-from-random-forest-models-with-ggraph/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://shiring.github.io/machine_learning/2017/03/16/rf_plot_ggraph"> Shirin's playgRound</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>Today, I want to show how I use Thomas Lin Pederson’s awesome <a target="_blank" rel="nofollow" href="https://github.com/thomasp85/ggraph">ggraph</a> package to plot decision trees from Random Forest models.</p>
<p>I am very much a visual person, so I try to plot as much of my results as possible because it helps me get a better feel for what is going on with my data.</p>
<p>A nice aspect of using tree-based machine learning, like Random Forest models, is that that they are more easily interpreted than e.g. neural networks as they are based on decision trees. So, when I am using such models, I like to plot final decision trees (if they aren’t too large) to get a sense of which decisions are underlying my predictions.</p>
<p>There are a few very convient ways to plot the outcome if you are using the <code>randomForest</code> package but I like to have as much control as possible about the layout, colors, labels, etc. And because I didn’t find a solution I liked for <code>caret</code> models, I developed the following little function (below you may find information about how I built the model):</p>
<p>As input, it takes part of the output from <code>model_rf &lt;- caret::train(... &quot;rf&quot; ...)</code>, that gives the trees of the final model: <code>model_rf$finalModel$forest</code>. From these trees, you can specify which one to plot by index.</p>
<div>
<pre><code><span>library</span><span>(</span><span>dplyr</span><span>)</span><span>
</span><span>library</span><span>(</span><span>ggraph</span><span>)</span><span>
</span><span>library</span><span>(</span><span>igraph</span><span>)</span><span>
</span><span>tree_func</span><span> </span><span>&lt;-</span><span> </span><span>function</span><span>(</span><span>final_model</span><span>,</span><span> </span><span>tree_num</span><span>)</span><span> </span><span>{</span><span>
</span><span># get tree by index
</span><span> </span><span>tree</span><span> </span><span>&lt;-</span><span> </span><span>randomForest</span><span>::</span><span>getTree</span><span>(</span><span>final_model</span><span>,</span><span> </span><span>k</span><span> </span><span>=</span><span> </span><span>tree_num</span><span>,</span><span> </span><span>labelVar</span><span> </span><span>=</span><span> </span><span>TRUE</span><span>)</span><span> </span><span>%>%</span><span>
</span><span>tibble</span><span>::</span><span>rownames_to_column</span><span>()</span><span> </span><span>%>%</span><span>
</span><span># make leaf split points to NA, so the 0s won't get plotted
</span><span> </span><span>mutate</span><span>(</span><span>`split point`</span><span> </span><span>=</span><span> </span><span>ifelse</span><span>(</span><span>is.na</span><span>(</span><span>prediction</span><span>),</span><span> </span><span>`split point`</span><span>,</span><span> </span><span>NA</span><span>))</span><span>
</span><span># prepare data frame for graph
</span><span> </span><span>graph_frame</span><span> </span><span>&lt;-</span><span> </span><span>data.frame</span><span>(</span><span>from</span><span> </span><span>=</span><span> </span><span>rep</span><span>(</span><span>tree</span><span>$</span><span>rowname</span><span>,</span><span> </span><span>2</span><span>),</span><span>
</span><span>to</span><span> </span><span>=</span><span> </span><span>c</span><span>(</span><span>tree</span><span>$</span><span>`left daughter`</span><span>,</span><span> </span><span>tree</span><span>$</span><span>`right daughter`</span><span>))</span><span>
</span><span># convert to graph and delete the last node that we don't want to plot
</span><span> </span><span>graph</span><span> </span><span>&lt;-</span><span> </span><span>graph_from_data_frame</span><span>(</span><span>graph_frame</span><span>)</span><span> </span><span>%>%</span><span>
</span><span>delete_vertices</span><span>(</span><span>&quot;0&quot;</span><span>)</span><span>
</span><span># set node labels
</span><span> </span><span>V</span><span>(</span><span>graph</span><span>)</span><span>$</span><span>node_label</span><span> </span><span>&lt;-</span><span> </span><span>gsub</span><span>(</span><span>&quot;_&quot;</span><span>,</span><span> </span><span>&quot; &quot;</span><span>,</span><span> </span><span>as.character</span><span>(</span><span>tree</span><span>$</span><span>`split var`</span><span>))</span><span>
</span><span>V</span><span>(</span><span>graph</span><span>)</span><span>$</span><span>leaf_label</span><span> </span><span>&lt;-</span><span> </span><span>as.character</span><span>(</span><span>tree</span><span>$</span><span>prediction</span><span>)</span><span>
</span><span>V</span><span>(</span><span>graph</span><span>)</span><span>$</span><span>split</span><span> </span><span>&lt;-</span><span> </span><span>as.character</span><span>(</span><span>round</span><span>(</span><span>tree</span><span>$</span><span>`split point`</span><span>,</span><span> </span><span>digits</span><span> </span><span>=</span><span> </span><span>2</span><span>))</span><span>
</span><span># plot
</span><span> </span><span>plot</span><span> </span><span>&lt;-</span><span> </span><span>ggraph</span><span>(</span><span>graph</span><span>,</span><span> </span><span>'dendrogram'</span><span>)</span><span> </span><span>+</span><span> </span><span>theme_bw</span><span>()</span><span> </span><span>+</span><span>
</span><span>geom_edge_link</span><span>()</span><span> </span><span>+</span><span>
</span><span>geom_node_point</span><span>()</span><span> </span><span>+</span><span>
</span><span>geom_node_text</span><span>(</span><span>aes</span><span>(</span><span>label</span><span> </span><span>=</span><span> </span><span>node_label</span><span>),</span><span> </span><span>na.rm</span><span> </span><span>=</span><span> </span><span>TRUE</span><span>,</span><span> </span><span>repel</span><span> </span><span>=</span><span> </span><span>TRUE</span><span>)</span><span> </span><span>+</span><span>
</span><span>geom_node_label</span><span>(</span><span>aes</span><span>(</span><span>label</span><span> </span><span>=</span><span> </span><span>split</span><span>),</span><span> </span><span>vjust</span><span> </span><span>=</span><span> </span><span>2.5</span><span>,</span><span> </span><span>na.rm</span><span> </span><span>=</span><span> </span><span>TRUE</span><span>,</span><span> </span><span>fill</span><span> </span><span>=</span><span> </span><span>&quot;white&quot;</span><span>)</span><span> </span><span>+</span><span>
</span><span>geom_node_label</span><span>(</span><span>aes</span><span>(</span><span>label</span><span> </span><span>=</span><span> </span><span>leaf_label</span><span>,</span><span> </span><span>fill</span><span> </span><span>=</span><span> </span><span>leaf_label</span><span>),</span><span> </span><span>na.rm</span><span> </span><span>=</span><span> </span><span>TRUE</span><span>,</span><span> </span><span>repel</span><span> </span><span>=</span><span> </span><span>TRUE</span><span>,</span><span> </span><span>colour</span><span> </span><span>=</span><span> </span><span>&quot;white&quot;</span><span>,</span><span> </span><span>fontface</span><span> </span><span>=</span><span> </span><span>&quot;bold&quot;</span><span>,</span><span> </span><span>show.legend</span><span> </span><span>=</span><span> </span><span>FALSE</span><span>)</span><span> </span><span>+</span><span>
</span><span>theme</span><span>(</span><span>panel.grid.minor</span><span> </span><span>=</span><span> </span><span>element_blank</span><span>(),</span><span>
</span><span>panel.grid.major</span><span> </span><span>=</span><span> </span><span>element_blank</span><span>(),</span><span>
</span><span>panel.background</span><span> </span><span>=</span><span> </span><span>element_blank</span><span>(),</span><span>
</span><span>plot.background</span><span> </span><span>=</span><span> </span><span>element_rect</span><span>(</span><span>fill</span><span> </span><span>=</span><span> </span><span>&quot;white&quot;</span><span>),</span><span>
</span><span>panel.border</span><span> </span><span>=</span><span> </span><span>element_blank</span><span>(),</span><span>
</span><span>axis.line</span><span> </span><span>=</span><span> </span><span>element_blank</span><span>(),</span><span>
</span><span>axis.text.x</span><span> </span><span>=</span><span> </span><span>element_blank</span><span>(),</span><span>
</span><span>axis.text.y</span><span> </span><span>=</span><span> </span><span>element_blank</span><span>(),</span><span>
</span><span>axis.ticks</span><span> </span><span>=</span><span> </span><span>element_blank</span><span>(),</span><span>
</span><span>axis.title.x</span><span> </span><span>=</span><span> </span><span>element_blank</span><span>(),</span><span>
</span><span>axis.title.y</span><span> </span><span>=</span><span> </span><span>element_blank</span><span>(),</span><span>
</span><span>plot.title</span><span> </span><span>=</span><span> </span><span>element_text</span><span>(</span><span>size</span><span> </span><span>=</span><span> </span><span>18</span><span>))</span><span>
</span><span>print</span><span>(</span><span>plot</span><span>)</span><span>
</span><span>}</span><span>
</span></code></pre>
</div>
<p></p>
<p>We can now plot, e.g. the tree with the smalles number of nodes:</p>
<div>
<pre><code><span>tree_num</span><span> </span><span>&lt;-</span><span> </span><span>which</span><span>(</span><span>model_rf</span><span>$</span><span>finalModel</span><span>$</span><span>forest</span><span>$</span><span>ndbigtree</span><span> </span><span>==</span><span> </span><span>min</span><span>(</span><span>model_rf</span><span>$</span><span>finalModel</span><span>$</span><span>forest</span><span>$</span><span>ndbigtree</span><span>))</span><span>
</span><span>tree_func</span><span>(</span><span>final_model</span><span> </span><span>=</span><span> </span><span>model_rf</span><span>$</span><span>finalModel</span><span>,</span><span> </span><span>tree_num</span><span>)</span><span>
</span></code></pre>
</div>
<p><img alt="" src="https://i1.wp.com/shiring.github.io/machine_learning/2017/03/16/rf_plot_ggraph_files/figure-markdown_github/unnamed-chunk-3-1.png?w=456&ssl=1" data-recalc-dims="1"></p>
<p></p>
<p>Or we can plot the tree with the biggest number of nodes:</p>
<div>
<pre><code><span>tree_num</span><span> </span><span>&lt;-</span><span> </span><span>which</span><span>(</span><span>model_rf</span><span>$</span><span>finalModel</span><span>$</span><span>forest</span><span>$</span><span>ndbigtree</span><span> </span><span>==</span><span> </span><span>max</span><span>(</span><span>model_rf</span><span>$</span><span>finalModel</span><span>$</span><span>forest</span><span>$</span><span>ndbigtree</span><span>))</span><span>
</span><span>tree_func</span><span>(</span><span>final_model</span><span> </span><span>=</span><span> </span><span>model_rf</span><span>$</span><span>finalModel</span><span>,</span><span> </span><span>tree_num</span><span>)</span><span>
</span></code></pre>
</div>
<p><img alt="" src="https://i0.wp.com/shiring.github.io/machine_learning/2017/03/16/rf_plot_ggraph_files/figure-markdown_github/unnamed-chunk-4-1.png?w=456&ssl=1" data-recalc-dims="1"></p>
<hr>
<p></p>
<h3>Preparing the data and modeling</h3>
<p>The data set I am using in these example analyses, is the <strong>Breast Cancer Wisconsin (Diagnostic) Dataset</strong>. The data was downloaded from the <a target="_blank" rel="nofollow" href="http://archive.ics.uci.edu/ml/datasets/Breast+Cancer+Wisconsin+%28Diagnostic%29">UC Irvine Machine Learning Repository</a>.</p>
<p>The first data set looks at the predictor classes:</p>
<ul>
<li>malignant or</li>
<li>benign breast mass.</li>
</ul>
<p>The features characterize cell nucleus properties and were generated from image analysis of <a target="_blank" rel="nofollow" href="https://en.wikipedia.org/wiki/Fine-needle_aspiration">fine needle aspirates (FNA)</a> of breast masses:</p>
<ul>
<li>Sample ID (code number)</li>
<li>Clump thickness</li>
<li>Uniformity of cell size</li>
<li>Uniformity of cell shape</li>
<li>Marginal adhesion</li>
<li>Single epithelial cell size</li>
<li>Number of bare nuclei</li>
<li>Bland chromatin</li>
<li>Number of normal nuclei</li>
<li>Mitosis</li>
<li>Classes, i.e. diagnosis</li>
</ul>
<div>
<pre><code><span>bc_data</span><span> </span><span>&lt;-</span><span> </span><span>read.table</span><span>(</span><span>&quot;datasets/breast-cancer-wisconsin.data.txt&quot;</span><span>,</span><span> </span><span>header</span><span> </span><span>=</span><span> </span><span>FALSE</span><span>,</span><span> </span><span>sep</span><span> </span><span>=</span><span> </span><span>&quot;,&quot;</span><span>)</span><span>
</span><span>colnames</span><span>(</span><span>bc_data</span><span>)</span><span> </span><span>&lt;-</span><span> </span><span>c</span><span>(</span><span>&quot;sample_code_number&quot;</span><span>,</span><span> </span><span>&quot;clump_thickness&quot;</span><span>,</span><span> </span><span>&quot;uniformity_of_cell_size&quot;</span><span>,</span><span> </span><span>&quot;uniformity_of_cell_shape&quot;</span><span>,</span><span> </span><span>&quot;marginal_adhesion&quot;</span><span>,</span><span> </span><span>&quot;single_epithelial_cell_size&quot;</span><span>,</span><span> </span><span>&quot;bare_nuclei&quot;</span><span>,</span><span> </span><span>&quot;bland_chromatin&quot;</span><span>,</span><span> </span><span>&quot;normal_nucleoli&quot;</span><span>,</span><span> </span><span>&quot;mitosis&quot;</span><span>,</span><span> </span><span>&quot;classes&quot;</span><span>)</span><span>
</span><span>bc_data</span><span>$</span><span>classes</span><span> </span><span>&lt;-</span><span> </span><span>ifelse</span><span>(</span><span>bc_data</span><span>$</span><span>classes</span><span> </span><span>==</span><span> </span><span>&quot;2&quot;</span><span>,</span><span> </span><span>&quot;benign&quot;</span><span>,</span><span>
</span><span>ifelse</span><span>(</span><span>bc_data</span><span>$</span><span>classes</span><span> </span><span>==</span><span> </span><span>&quot;4&quot;</span><span>,</span><span> </span><span>&quot;malignant&quot;</span><span>,</span><span> </span><span>NA</span><span>))</span><span>
</span><span>bc_data</span><span>[</span><span>bc_data</span><span> </span><span>==</span><span> </span><span>&quot;?&quot;</span><span>]</span><span> </span><span>&lt;-</span><span> </span><span>NA</span><span>
</span><span># impute missing data
</span><span>library</span><span>(</span><span>mice</span><span>)</span><span>
</span><span>bc_data</span><span>[,</span><span>2</span><span>:</span><span>10</span><span>]</span><span> </span><span>&lt;-</span><span> </span><span>apply</span><span>(</span><span>bc_data</span><span>[,</span><span> </span><span>2</span><span>:</span><span>10</span><span>],</span><span> </span><span>2</span><span>,</span><span> </span><span>function</span><span>(</span><span>x</span><span>)</span><span> </span><span>as.numeric</span><span>(</span><span>as.character</span><span>(</span><span>x</span><span>)))</span><span>
</span><span>dataset_impute</span><span> </span><span>&lt;-</span><span> </span><span>mice</span><span>(</span><span>bc_data</span><span>[,</span><span> </span><span>2</span><span>:</span><span>10</span><span>],</span><span> </span><span>print</span><span> </span><span>=</span><span> </span><span>FALSE</span><span>)</span><span>
</span><span>bc_data</span><span> </span><span>&lt;-</span><span> </span><span>cbind</span><span>(</span><span>bc_data</span><span>[,</span><span> </span><span>11</span><span>,</span><span> </span><span>drop</span><span> </span><span>=</span><span> </span><span>FALSE</span><span>],</span><span> </span><span>mice</span><span>::</span><span>complete</span><span>(</span><span>dataset_impute</span><span>,</span><span> </span><span>1</span><span>))</span><span>
</span><span>bc_data</span><span>$</span><span>classes</span><span> </span><span>&lt;-</span><span> </span><span>as.factor</span><span>(</span><span>bc_data</span><span>$</span><span>classes</span><span>)</span><span>
</span><span># how many benign and malignant cases are there?
</span><span>summary</span><span>(</span><span>bc_data</span><span>$</span><span>classes</span><span>)</span><span>
</span><span># separate into training and test data
</span><span>library</span><span>(</span><span>caret</span><span>)</span><span>
</span><span>set.seed</span><span>(</span><span>42</span><span>)</span><span>
</span><span>index</span><span> </span><span>&lt;-</span><span> </span><span>createDataPartition</span><span>(</span><span>bc_data</span><span>$</span><span>classes</span><span>,</span><span> </span><span>p</span><span> </span><span>=</span><span> </span><span>0.7</span><span>,</span><span> </span><span>list</span><span> </span><span>=</span><span> </span><span>FALSE</span><span>)</span><span>
</span><span>train_data</span><span> </span><span>&lt;-</span><span> </span><span>bc_data</span><span>[</span><span>index</span><span>,</span><span> </span><span>]</span><span>
</span><span>test_data</span><span> </span><span>&lt;-</span><span> </span><span>bc_data</span><span>[</span><span>-</span><span>index</span><span>,</span><span> </span><span>]</span><span>
</span><span># run model
</span><span>set.seed</span><span>(</span><span>42</span><span>)</span><span>
</span><span>model_rf</span><span> </span><span>&lt;-</span><span> </span><span>caret</span><span>::</span><span>train</span><span>(</span><span>classes</span><span> </span><span>~</span><span> </span><span>.</span><span>,</span><span>
</span><span>data</span><span> </span><span>=</span><span> </span><span>train_data</span><span>,</span><span>
</span><span>method</span><span> </span><span>=</span><span> </span><span>&quot;rf&quot;</span><span>,</span><span>
</span><span>preProcess</span><span> </span><span>=</span><span> </span><span>c</span><span>(</span><span>&quot;scale&quot;</span><span>,</span><span> </span><span>&quot;center&quot;</span><span>),</span><span>
</span><span>trControl</span><span> </span><span>=</span><span> </span><span>trainControl</span><span>(</span><span>method</span><span> </span><span>=</span><span> </span><span>&quot;repeatedcv&quot;</span><span>,</span><span> </span><span>number</span><span> </span><span>=</span><span> </span><span>10</span><span>,</span><span> </span><span>repeats</span><span> </span><span>=</span><span> </span><span>10</span><span>,</span><span> </span><span>savePredictions</span><span> </span><span>=</span><span> </span><span>TRUE</span><span>,</span><span> </span><span>verboseIter</span><span> </span><span>=</span><span> </span><span>FALSE</span><span>))</span><span>
</span></code></pre>
</div>
<hr>
<p></p>
<p>If you are interested in more machine learning posts, check out <a target="_blank" rel="nofollow" href="https://shiring.github.io/categories.html#machine_learning-ref">the category listing for <strong>machine_learning</strong> on my blog</a>.</p>
<hr>
<p></p>
<div>
<pre><code><span>sessionInfo</span><span>()</span><span>
</span></code></pre>
</div>
<div>
<pre><code>## R version 3.3.3 (2017-03-06)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## Running under: Windows 7 x64 (build 7601) Service Pack 1
## 
## locale:
## [1] LC_COLLATE=English_United States.1252 
## [2] LC_CTYPE=English_United States.1252   
## [3] LC_MONETARY=English_United States.1252
## [4] LC_NUMERIC=C                          
## [5] LC_TIME=English_United States.1252    
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
## [1] igraph_1.0.1       ggraph_1.0.0       ggplot2_2.2.1.9000
## [4] dplyr_0.5.0       
## 
## loaded via a namespace (and not attached):
##  [1] Rcpp_0.12.9         nloptr_1.0.4        plyr_1.8.4         
##  [4] viridis_0.3.4       iterators_1.0.8     tools_3.3.3        
##  [7] digest_0.6.12       lme4_1.1-12         evaluate_0.10      
## [10] tibble_1.2          gtable_0.2.0        nlme_3.1-131       
## [13] lattice_0.20-34     mgcv_1.8-17         Matrix_1.2-8       
## [16] foreach_1.4.3       DBI_0.6             ggrepel_0.6.5      
## [19] yaml_2.1.14         parallel_3.3.3      SparseM_1.76       
## [22] gridExtra_2.2.1     stringr_1.2.0       knitr_1.15.1       
## [25] MatrixModels_0.4-1  stats4_3.3.3        rprojroot_1.2      
## [28] grid_3.3.3          caret_6.0-73        nnet_7.3-12        
## [31] R6_2.2.0            rmarkdown_1.3       minqa_1.2.4        
## [34] udunits2_0.13       tweenr_0.1.5        deldir_0.1-12      
## [37] reshape2_1.4.2      car_2.1-4           magrittr_1.5       
## [40] units_0.4-2         backports_1.0.5     scales_0.4.1       
## [43] codetools_0.2-15    ModelMetrics_1.1.0  htmltools_0.3.5    
## [46] MASS_7.3-45         splines_3.3.3       randomForest_4.6-12
## [49] assertthat_0.1      pbkrtest_0.4-6      ggforce_0.1.1      
## [52] colorspace_1.3-2    labeling_0.3        quantreg_5.29      
## [55] stringi_1.1.2       lazyeval_0.2.0      munsell_0.4.3
</code></pre>
</div>
<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://shiring.github.io/machine_learning/2017/03/16/rf_plot_ggraph"> Shirin's playgRound</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/search/tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="https://www.r-bloggers.com/search/data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="https://www.r-bloggers.com/search/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/search/ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="https://www.r-bloggers.com/search/map">maps</a>, <a title="Animation in R" rel="nofollow" href="https://www.r-bloggers.com/search/animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="https://www.r-bloggers.com/search/RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="https://www.r-bloggers.com/search/sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="https://www.r-bloggers.com/search/SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="https://www.r-bloggers.com/search/eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="https://www.r-bloggers.com/search/git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="https://www.r-bloggers.com/search/hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="https://www.r-bloggers.com/search/PCA">PCA</a>, <a title="Time series" rel="nofollow" href="https://www.r-bloggers.com/search/time+series">time series</a>, <a title="finance trading" rel="nofollow" href="https://www.r-bloggers.com/search/trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/gh3bToq9gnA"></a></div>