<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/a-more-systematic-look-at-suppressed-data-by-ellis2013nz/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://freerangestats.info/blog/2018/11/18/suppressed-data-2"> free range statistics - R</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p><a rel="nofollow" href="http://freerangestats.info/blog/2018/11/06/suppressed-data" target="_blank">Last week I blogged about some different ways of dealing with data in a cross tab that has been suppressed</a> as a means of disclosure control, when the count in a cell is less than six. I tried simple replacement of those cells with “3”, two different multiple imputation methods, and left-censored Poisson regression based on survival methods. I tested those methods on a single two-way simulated cross-tab of the counts of three different types of animals in four different regions, with two suppressed cells.</p>
<p>An obvious piece of unfinished business is to extend the comparison I made to many different randomly generated tables. I have now done this, and I’ve also extended out the methods I’m comparing to cover three different multiple imputation methods and four different simple substitutions (with 0, 1, 3 and 5).</p>
<p>Because my tables are generated by a data generating process under my control, I know the true values of coefficients for the fully saturated Poisson family generalized linear model that is being used to analyse each table with each imputation method. So I can compare the true coefficients with those for each method, including using the full observed data (as though you had access to it, perhaps because you work for the agency that suppressed the data in the first instance). Note – if a fully saturated Poisson family generalized linear model sounds complicated, you can remember that it is the Chi square test for independence of variables in a cross tab which is usually one of the first two or three tools taught in a basic statistics methods class.</p>
<h2>Some surprising results</h2>
<p>It’s fair to say the results surprised me.</p>
<p><img width="100%" src="http://freerangestats.info/img/0139-boxplot.svg"></p>
<ul>
<li>The best of the nine methods was simply to replace all values below six with the number 5</li>
<li>Four of the methods delivered better results on average in uncovering the true data generating process than did <em>fitting the model to the real, unsuppressed data</em></li>
<li>My multiple imputation that provides numbers from zero to five with probabilities based on a truncated Poisson distribution is the best of the fancy methods, but only very slightly better than the default imputation from the <code>mice</code> package, which allows imputed values to be greater than 5 even though we know the reality wasn’t that big</li>
<li>left-censored Poisson regression with survival analysis methods still performs not particularly well.</li>
</ul>
<p>My simulations were of tables from two to ten columns and two to ten rows. All the true coefficients for effect sizes including interactions were from a uniform distribution between -1 and 1. The intercept was drawn from a uniform distribution from 1 to 3. The intercept was excluded from the calculation of the mean square error of coefficients, because it’s usually not of substantive interest and because it is on a different scale to the other coefficients.</p>
<p>Looking at the relationship of error in coefficients to the size of the table and to the proportion of cells that were suppressed for being below six, we get these charts:</p>
<p><img width="100%" src="http://freerangestats.info/img/0139-scatter.svg"></p>
<p><img width="100%" src="http://freerangestats.info/img/0139-scatter-n.svg"></p>
<p>There are some interesting findings here too:</p>
<ul>
<li>all methods perform worse as the proportion of cells under six increases, but for the poorer performing methods this is a stronger effect</li>
<li>all methods perform worse with more coefficents to estimate, but this is strongest for the method using the unsuppressed data</li>
<li>the unsuppressed data is clearly bimodal, with a cluster of poorly performing models well separated from an otherwise good performance.</li>
</ul>
<h2>Unusual behaviour of model with the model with full unsuppressed data</h2>
<p>This last point about bimodality of performance of the model with the full unsuppressed data is particularly interesting. It wasn’t obvious in my first boxplot, because while that’s a nice simple comparison graphic it will usually hide bi-modality in a distribution. Here’s density plots instead:</p>
<p><img width="100%" src="http://freerangestats.info/img/0139-densities.svg"></p>
<p>It’s worth having a closer look at this. Unlike the other methods, using the full data normally performs exceptionally well (as would be expected) but sometimes extremely badly. Is there any pattern? Let’s look at a plot of the mean squared error across the size of the cross tab and the proportion of cells that were suppressed, just for the method that uses the full data despite suppression:</p>
<p><img width="100%" src="http://freerangestats.info/img/0139-full-data-method.svg"></p>
<p>There’s a definite pattern that the more data were below 6, the worse this model does, but there are still occasions even when half the data are below 6 the model does ok (small reddish dots).</p>
<p>Luckily I had written the function that compares the models so it can be reproducible and provide the full set of coefficients. I had a look at one run that was particularly poor performing for the full data model, number 125. Here is the actual data for run 125:</p>
<table>
<thead>
<tr>
<th>animals</th>
<th>region</th>
<th>count</th>
<th>expected</th>
</tr>
</thead>
<tbody>
<tr>
<td>a</td>
<td>A</td>
<td>0</td>
<td>4.9508590</td>
</tr>
<tr>
<td>b</td>
<td>A</td>
<td>5</td>
<td>3.7161291</td>
</tr>
<tr>
<td>c</td>
<td>A</td>
<td>6</td>
<td>12.5528917</td>
</tr>
<tr>
<td>d</td>
<td>A</td>
<td>17</td>
<td>12.6124215</td>
</tr>
<tr>
<td>e</td>
<td>A</td>
<td>2</td>
<td>5.2896170</td>
</tr>
<tr>
<td>f</td>
<td>A</td>
<td>1</td>
<td>3.5390988</td>
</tr>
<tr>
<td>g</td>
<td>A</td>
<td>10</td>
<td>6.7345340</td>
</tr>
<tr>
<td>h</td>
<td>A</td>
<td>6</td>
<td>6.2255400</td>
</tr>
<tr>
<td>i</td>
<td>A</td>
<td>3</td>
<td>1.8735223</td>
</tr>
<tr>
<td>a</td>
<td>B</td>
<td>7</td>
<td>8.3839561</td>
</tr>
<tr>
<td>b</td>
<td>B</td>
<td>5</td>
<td>2.8352860</td>
</tr>
<tr>
<td>c</td>
<td>B</td>
<td>20</td>
<td>23.8147302</td>
</tr>
<tr>
<td>d</td>
<td>B</td>
<td>21</td>
<td>18.3545554</td>
</tr>
<tr>
<td>e</td>
<td>B</td>
<td>6</td>
<td>7.6222396</td>
</tr>
<tr>
<td>f</td>
<td>B</td>
<td>14</td>
<td>14.2599204</td>
</tr>
<tr>
<td>g</td>
<td>B</td>
<td>18</td>
<td>16.0890494</td>
</tr>
<tr>
<td>h</td>
<td>B</td>
<td>17</td>
<td>17.6865488</td>
</tr>
<tr>
<td>i</td>
<td>B</td>
<td>2</td>
<td>2.4653642</td>
</tr>
<tr>
<td>a</td>
<td>C</td>
<td>5</td>
<td>3.7365829</td>
</tr>
<tr>
<td>b</td>
<td>C</td>
<td>1</td>
<td>4.4282008</td>
</tr>
<tr>
<td>c</td>
<td>C</td>
<td>15</td>
<td>13.6843526</td>
</tr>
<tr>
<td>d</td>
<td>C</td>
<td>6</td>
<td>6.3213678</td>
</tr>
<tr>
<td>e</td>
<td>C</td>
<td>7</td>
<td>4.6640287</td>
</tr>
<tr>
<td>f</td>
<td>C</td>
<td>4</td>
<td>1.1177665</td>
</tr>
<tr>
<td>g</td>
<td>C</td>
<td>9</td>
<td>8.5946791</td>
</tr>
<tr>
<td>h</td>
<td>C</td>
<td>1</td>
<td>2.2103981</td>
</tr>
<tr>
<td>i</td>
<td>C</td>
<td>0</td>
<td>0.7286345</td>
</tr>
</tbody>
</table>
<p>… and here are the coefficients from all the models, compared to the true coefficients of the underlying data generating process:</p>
<p><img width="100%" src="http://freerangestats.info/img/0139-run125.svg"></p>
<p>So that’s interesting. It’s revealing that the full data model performs badly in a similar way to the absurb “replace all suppressed cells with zero” model. What’s going on here is that the observed data has an unusual number of very low values (eg a-A-0, f-A-1, b-C-1). The low values lead to a very unstable estimate of our Poisson regression model, and coefficients leap up to +25 and -25 (when the real values are between -1 and 1). This happens in enough runs that these wildly underperforming models totally mess up the record of the full data model.</p>
<p>What we’re seeing here is that this sort of model – a Poisson family GLM fit to a cross tab – performs erratically (and potentially delivers ridiculous results) when lots of counts are low. Which of course has been known since the early days of the Chi square test and the warning not to use it when expected counts are less than five.</p>
<p>A probable solution is clear – some kind of shrinkage of coefficient estimates, either through regularization if we’re a frequentist or a more sensible prior if we’re a Bayesian. Then I suspect the full data model would perform quite adequately.</p>
<h2>Code</h2>
<p>Here’s the R code for today’s exercise, all in one chunk:</p>
<figure>
<pre><code data-lang="r"><span>library</span><span>(</span><span>tidyverse</span><span>)</span><span>
</span><span>library</span><span>(</span><span>mice</span><span>)</span><span>
</span><span>library</span><span>(</span><span>VGAM</span><span>)</span><span>
</span><span>library</span><span>(</span><span>Cairo</span><span>)</span><span>
</span><span>library</span><span>(</span><span>parallel</span><span>)</span><span>
</span><span>#------------------ imputation functions----------
</span><span>#' Imputation function for suppressed data for use with mice - Poisson-based
#'
#' @param y vector to be imputed
#' @param ry logical vector of observed (TRUE) and missing (FALSE) values of y
#' @param x design matrix. Ignored but is probably needed for mice to use.
#' @param wy vector that is TRUE where imputations are created for y. Not sure when this is different
#' to just !ry (which is the default).
</span><span>mice.impute.desuppress</span><span> </span><span>&lt;-</span><span> </span><span>function</span><span> </span><span>(</span><span>y</span><span>,</span><span> </span><span>ry</span><span>,</span><span> </span><span>x</span><span>,</span><span> </span><span>wy</span><span> </span><span>=</span><span> </span><span>NULL</span><span>,</span><span> </span><span>max_value</span><span> </span><span>=</span><span> </span><span>5</span><span>,</span><span> </span><span>...</span><span>)</span><span> </span><span>{</span><span>
</span><span># during dev:
</span><span> </span><span># y &lt;-data$censored_count_num; ry &lt;-!is.na(y)
</span><span> </span><span>if</span><span> </span><span>(</span><span>is.null</span><span>(</span><span>wy</span><span>)){</span><span> </span><span>wy</span><span> </span><span>&lt;-</span><span> </span><span>!</span><span>ry</span><span>
</span><span>}</span><span>
</span><span># What are the relative chances of getting values from 0 to the maximum allowed value,
</span><span> </span><span># if we have a Poisson distribution which we have estimated the mean of via trimmed mean?
</span><span> </span><span># (this is very approximate but probably better than just giving equal chances to 0:5)
</span><span> </span><span>probs</span><span> </span><span>&lt;-</span><span> </span><span>dpois</span><span>(</span><span>0</span><span>:</span><span>max_value</span><span>,</span><span> </span><span>mean</span><span>(</span><span>y</span><span>[</span><span>ry</span><span>],</span><span> </span><span>tr</span><span> </span><span>=</span><span> </span><span>0.2</span><span>))</span><span>
</span><span>return</span><span>(</span><span>sample</span><span>(</span><span>0</span><span>:</span><span>max_value</span><span>,</span><span> </span><span>sum</span><span>(</span><span>wy</span><span>),</span><span> </span><span>prob</span><span> </span><span>=</span><span> </span><span>probs</span><span>,</span><span> </span><span>replace</span><span> </span><span>=</span><span> </span><span>TRUE</span><span>))</span><span>
</span><span>}</span><span>
</span><span>#' Imputation function for suppressed data for use with mice - simple
#'
</span><span>mice.impute.uniform</span><span> </span><span>&lt;-</span><span> </span><span>function</span><span> </span><span>(</span><span>y</span><span>,</span><span> </span><span>ry</span><span>,</span><span> </span><span>x</span><span>,</span><span> </span><span>wy</span><span> </span><span>=</span><span> </span><span>NULL</span><span>,</span><span> </span><span>max_value</span><span> </span><span>=</span><span> </span><span>5</span><span>,</span><span> </span><span>...</span><span>)</span><span> </span><span>{</span><span>
</span><span>if</span><span> </span><span>(</span><span>is.null</span><span>(</span><span>wy</span><span>)){</span><span> </span><span>wy</span><span> </span><span>&lt;-</span><span> </span><span>!</span><span>ry</span><span>
</span><span>}</span><span>
</span><span>return</span><span>(</span><span>sample</span><span>(</span><span>0</span><span>:</span><span>max_value</span><span>,</span><span> </span><span>sum</span><span>(</span><span>wy</span><span>),</span><span> </span><span>replace</span><span> </span><span>=</span><span> </span><span>TRUE</span><span>))</span><span>
</span><span>}</span><span>
</span><span>#--------------main function---------------
# This function generates data and compares coefficients
</span><span>coefs_comp</span><span> </span><span>&lt;-</span><span> </span><span>function</span><span>(</span><span>run</span><span>,</span><span> </span><span>output</span><span> </span><span>=</span><span> </span><span>c</span><span>(</span><span>&quot;summary&quot;</span><span>,</span><span> </span><span>&quot;all&quot;</span><span>)){</span><span>
</span><span>set.seed</span><span>(</span><span>run</span><span>)</span><span>
</span><span>output</span><span> </span><span>&lt;-</span><span> </span><span>match.arg</span><span>(</span><span>output</span><span>)</span><span>
</span><span>data</span><span> </span><span>&lt;-</span><span> </span><span>expand.grid</span><span>(</span><span>animals</span><span> </span><span>=</span><span> </span><span>letters</span><span>[</span><span>1</span><span>:</span><span>sample</span><span>(</span><span>2</span><span>:</span><span>10</span><span>,</span><span> </span><span>1</span><span>)],</span><span>
</span><span>region</span><span> </span><span>=</span><span> </span><span>LETTERS</span><span>[</span><span>1</span><span>:</span><span>sample</span><span>(</span><span>2</span><span>:</span><span>10</span><span>,</span><span> </span><span>1</span><span>)],</span><span>
</span><span>count</span><span> </span><span>=</span><span> </span><span>1</span><span>)</span><span> </span><span>n</span><span> </span><span>&lt;-</span><span> </span><span>nrow</span><span>(</span><span>data</span><span>)</span><span>
</span><span>mm</span><span> </span><span>&lt;-</span><span> </span><span>model.matrix</span><span>(</span><span>count</span><span> </span><span>~</span><span> </span><span>animals</span><span> </span><span>*</span><span> </span><span>region</span><span>,</span><span> </span><span>data</span><span> </span><span>=</span><span> </span><span>data</span><span>)</span><span>
</span><span>true_coefs</span><span> </span><span>&lt;-</span><span> </span><span>c</span><span>(</span><span>runif</span><span>(</span><span>1</span><span>,</span><span> </span><span>1</span><span>,</span><span> </span><span>3</span><span>),</span><span> </span><span>runif</span><span>(</span><span>n</span><span> </span><span>-</span><span> </span><span>1</span><span>,</span><span> </span><span>-1</span><span>,</span><span> </span><span>1</span><span>))</span><span>
</span><span>data</span><span> </span><span>&lt;-</span><span> </span><span>data</span><span> </span><span>%>%</span><span>
</span><span>mutate</span><span>(</span><span>expected</span><span> </span><span>=</span><span> </span><span>exp</span><span>(</span><span>mm</span><span> </span><span>%*%</span><span> </span><span>true_coefs</span><span>),</span><span>
</span><span>count</span><span> </span><span>=</span><span> </span><span>rpois</span><span>(</span><span>n</span><span>,</span><span> </span><span>lambda</span><span> </span><span>=</span><span> </span><span>exp</span><span>(</span><span>mm</span><span> </span><span>%*%</span><span> </span><span>true_coefs</span><span>)),</span><span>
</span><span>censored_count</span><span> </span><span>=</span><span> </span><span>ifelse</span><span>(</span><span>count</span><span> </span><span></span><span> </span><span>6</span><span>,</span><span> </span><span>&quot;&lt;6&quot;</span><span>,</span><span> </span><span>count</span><span>),</span><span>
</span><span>censored_count_num</span><span> </span><span>=</span><span> </span><span>suppressWarnings</span><span>(</span><span>as.numeric</span><span>(</span><span>censored_count</span><span>)),</span><span>
</span><span>count_replaced_5</span><span> </span><span>=</span><span> </span><span>ifelse</span><span>(</span><span>count</span><span> </span><span></span><span> </span><span>6</span><span>,</span><span> </span><span>5</span><span>,</span><span> </span><span>count</span><span>),</span><span>
</span><span>count_replaced_3</span><span> </span><span>=</span><span> </span><span>ifelse</span><span>(</span><span>count</span><span> </span><span></span><span> </span><span>6</span><span>,</span><span> </span><span>3</span><span>,</span><span> </span><span>count</span><span>),</span><span>
</span><span>count_replaced_1</span><span> </span><span>=</span><span> </span><span>ifelse</span><span>(</span><span>count</span><span> </span><span></span><span> </span><span>6</span><span>,</span><span> </span><span>1</span><span>,</span><span> </span><span>count</span><span>),</span><span>
</span><span>count_replaced_0</span><span> </span><span>=</span><span> </span><span>ifelse</span><span>(</span><span>count</span><span> </span><span></span><span> </span><span>6</span><span>,</span><span> </span><span>0</span><span>,</span><span> </span><span>count</span><span>))</span><span>
</span><span>data</span><span>$</span><span>z</span><span> </span><span>&lt;-</span><span> </span><span>pmax</span><span>(</span><span>6</span><span>,</span><span> </span><span>data</span><span>$</span><span>count</span><span>)</span><span>
</span><span>data</span><span>$</span><span>lcensored</span><span> </span><span>&lt;-</span><span> </span><span>is.na</span><span>(</span><span>data</span><span>$</span><span>censored_count_num</span><span> </span><span>)</span><span>
</span><span>prop_suppressed</span><span> </span><span>&lt;-</span><span> </span><span>mean</span><span>(</span><span>data</span><span>$</span><span>lcensored</span><span>)</span><span>
</span><span>data</span><span>$</span><span>which_complete</span><span> </span><span>&lt;-</span><span> </span><span>as.numeric</span><span>(</span><span>!</span><span>data</span><span>$</span><span>lcensored</span><span>)</span><span>
</span><span>if</span><span>(</span><span>prop_suppressed</span><span> </span><span>></span><span> </span><span>0.5</span><span>){</span><span>
</span><span>return</span><span>(</span><span>NULL</span><span>)</span><span>
</span><span>}</span><span> </span><span>else</span><span> </span><span>{</span><span>
</span><span>#--------------straightforward methods-----------
</span><span> </span><span># with the full unsuppressed data, as though you were the ABS:
</span><span> </span><span>mod0</span><span> </span><span>&lt;-</span><span> </span><span>glm</span><span>(</span><span>count</span><span> </span><span>~</span><span> </span><span>animals</span><span> </span><span>*</span><span> </span><span>region</span><span>,</span><span> </span><span>data</span><span> </span><span>=</span><span> </span><span>data</span><span>,</span><span> </span><span>family</span><span> </span><span>=</span><span> </span><span>&quot;poisson&quot;</span><span>)</span><span>
</span><span># with replacing the suppressed data with 3 or 5:
</span><span> </span><span>mod1</span><span> </span><span>&lt;-</span><span> </span><span>glm</span><span>(</span><span>count_replaced_3</span><span> </span><span>~</span><span> </span><span>animals</span><span> </span><span>*</span><span> </span><span>region</span><span>,</span><span> </span><span>data</span><span> </span><span>=</span><span> </span><span>data</span><span>,</span><span> </span><span>family</span><span> </span><span>=</span><span> </span><span>&quot;poisson&quot;</span><span>)</span><span>
</span><span>mod2</span><span> </span><span>&lt;-</span><span> </span><span>glm</span><span>(</span><span>count_replaced_5</span><span> </span><span>~</span><span> </span><span>animals</span><span> </span><span>*</span><span> </span><span>region</span><span>,</span><span> </span><span>data</span><span> </span><span>=</span><span> </span><span>data</span><span>,</span><span> </span><span>family</span><span> </span><span>=</span><span> </span><span>&quot;poisson&quot;</span><span>)</span><span>
</span><span>mod2a</span><span> </span><span>&lt;-</span><span> </span><span>glm</span><span>(</span><span>count_replaced_1</span><span> </span><span>~</span><span> </span><span>animals</span><span> </span><span>*</span><span> </span><span>region</span><span>,</span><span> </span><span>data</span><span> </span><span>=</span><span> </span><span>data</span><span>,</span><span> </span><span>family</span><span> </span><span>=</span><span> </span><span>&quot;poisson&quot;</span><span>)</span><span>
</span><span>mod2b</span><span> </span><span>&lt;-</span><span> </span><span>glm</span><span>(</span><span>count_replaced_0</span><span> </span><span>~</span><span> </span><span>animals</span><span> </span><span>*</span><span> </span><span>region</span><span>,</span><span> </span><span>data</span><span> </span><span>=</span><span> </span><span>data</span><span>,</span><span> </span><span>family</span><span> </span><span>=</span><span> </span><span>&quot;poisson&quot;</span><span>)</span><span>
</span><span>#------------with censored poisson regression-------------------------
</span><span> </span><span>mod3</span><span> </span><span>&lt;-</span><span> </span><span>vglm</span><span>(</span><span>SurvS4</span><span>(</span><span>z</span><span>,</span><span> </span><span>which_complete</span><span>,</span><span> </span><span>type</span><span> </span><span>=</span><span> </span><span>&quot;left&quot;</span><span>)</span><span> </span><span>~</span><span> </span><span>animals</span><span> </span><span>*</span><span> </span><span>region</span><span>,</span><span> </span><span>family</span><span> </span><span>=</span><span> </span><span>cens.poisson</span><span>,</span><span> </span><span>data</span><span> </span><span>=</span><span> </span><span>data</span><span>)</span><span>
</span><span>#------------with multiple imputation
</span><span> </span><span># number of sets of imputations to make
</span><span> </span><span>m</span><span> </span><span>&lt;-</span><span> </span><span>20</span><span>
</span><span># See https://github.com/stefvanbuuren/mice/issues/150 for why remove.collinear = FALSE.
</span><span> </span><span>data_imp1</span><span> </span><span>&lt;-</span><span> </span><span>mice</span><span>(</span><span>data</span><span>[</span><span> </span><span>,</span><span> </span><span>c</span><span>(</span><span>&quot;censored_count_num&quot;</span><span>,</span><span> </span><span>&quot;animals&quot;</span><span>,</span><span> </span><span>&quot;region&quot;</span><span>)],</span><span> </span><span>method</span><span> </span><span>=</span><span> </span><span>&quot;desuppress&quot;</span><span>,</span><span> </span><span>print</span><span> </span><span>=</span><span> </span><span>FALSE</span><span>,</span><span> </span><span>m</span><span> </span><span>=</span><span> </span><span>m</span><span>,</span><span>
</span><span>remove.collinear</span><span> </span><span>=</span><span> </span><span>FALSE</span><span>)</span><span>
</span><span>data_imp2</span><span> </span><span>&lt;-</span><span> </span><span>mice</span><span>(</span><span>data</span><span>[</span><span> </span><span>,</span><span> </span><span>c</span><span>(</span><span>&quot;censored_count_num&quot;</span><span>,</span><span> </span><span>&quot;animals&quot;</span><span>,</span><span> </span><span>&quot;region&quot;</span><span>)],</span><span> </span><span>method</span><span> </span><span>=</span><span> </span><span>&quot;uniform&quot;</span><span>,</span><span> </span><span>print</span><span> </span><span>=</span><span> </span><span>FALSE</span><span>,</span><span> </span><span>m</span><span> </span><span>=</span><span> </span><span>m</span><span>,</span><span>
</span><span>remove.collinear</span><span> </span><span>=</span><span> </span><span>FALSE</span><span>)</span><span>
</span><span># default mice method:
</span><span> </span><span>data_imp3</span><span> </span><span>&lt;-</span><span> </span><span>mice</span><span>(</span><span>data</span><span>[</span><span> </span><span>,</span><span> </span><span>c</span><span>(</span><span>&quot;censored_count_num&quot;</span><span>,</span><span> </span><span>&quot;animals&quot;</span><span>,</span><span> </span><span>&quot;region&quot;</span><span>)],</span><span> </span><span>print</span><span> </span><span>=</span><span> </span><span>FALSE</span><span>,</span><span> </span><span>m</span><span> </span><span>=</span><span> </span><span>m</span><span>,</span><span>
</span><span>remove.collinear</span><span> </span><span>=</span><span> </span><span>FALSE</span><span>)</span><span>
</span><span>mod_mice1</span><span> </span><span>&lt;-</span><span> </span><span>with</span><span>(</span><span>data_imp1</span><span>,</span><span> </span><span>glm</span><span>(</span><span>censored_count_num</span><span> </span><span>~</span><span> </span><span>animals</span><span> </span><span>*</span><span> </span><span>region</span><span>,</span><span> </span><span>family</span><span> </span><span>=</span><span> </span><span>&quot;poisson&quot;</span><span>))</span><span>
</span><span>coef_mice1</span><span> </span><span>&lt;-</span><span> </span><span>pool</span><span>(</span><span>mod_mice1</span><span>)</span><span>$</span><span>pooled</span><span>$</span><span>estimate</span><span>
</span><span>mod_mice2</span><span> </span><span>&lt;-</span><span> </span><span>with</span><span>(</span><span>data_imp2</span><span>,</span><span> </span><span>glm</span><span>(</span><span>censored_count_num</span><span> </span><span>~</span><span> </span><span>animals</span><span> </span><span>*</span><span> </span><span>region</span><span>,</span><span> </span><span>family</span><span> </span><span>=</span><span> </span><span>&quot;poisson&quot;</span><span>))</span><span>
</span><span>coef_mice2</span><span> </span><span>&lt;-</span><span> </span><span>pool</span><span>(</span><span>mod_mice2</span><span>)</span><span>$</span><span>pooled</span><span>$</span><span>estimate</span><span>
</span><span>mod_mice3</span><span> </span><span>&lt;-</span><span> </span><span>with</span><span>(</span><span>data_imp3</span><span>,</span><span> </span><span>glm</span><span>(</span><span>censored_count_num</span><span> </span><span>~</span><span> </span><span>animals</span><span> </span><span>*</span><span> </span><span>region</span><span>,</span><span> </span><span>family</span><span> </span><span>=</span><span> </span><span>&quot;poisson&quot;</span><span>))</span><span>
</span><span>coef_mice3</span><span> </span><span>&lt;-</span><span> </span><span>pool</span><span>(</span><span>mod_mice3</span><span>)</span><span>$</span><span>pooled</span><span>$</span><span>estimate</span><span>
</span><span>#---------------results----------------------
</span><span> </span><span># comparison data
</span><span> </span><span>d</span><span> </span><span>&lt;-</span><span> </span><span>data_frame</span><span>(</span><span>underlying</span><span> </span><span>=</span><span> </span><span>true_coefs</span><span>,</span><span> </span><span>`Using full data including suppressed values (not usually possible!)`</span><span> </span><span>=</span><span> </span><span>coef</span><span>(</span><span>mod0</span><span>),</span><span>
</span><span>`Replacing suppressed values with 0`</span><span> </span><span>=</span><span> </span><span>coef</span><span>(</span><span>mod2b</span><span>),</span><span>
</span><span>`Replacing suppressed values with 1`</span><span> </span><span>=</span><span> </span><span>coef</span><span>(</span><span>mod2a</span><span>),</span><span>
</span><span>`Replacing suppressed values with 3`</span><span> </span><span>=</span><span> </span><span>coef</span><span>(</span><span>mod1</span><span>),</span><span>
</span><span>`Replacing suppressed values with 5`</span><span> </span><span>=</span><span> </span><span>coef</span><span>(</span><span>mod2</span><span>),</span><span>
</span><span>`Left-censored survival-based method`</span><span> </span><span>=</span><span> </span><span>coef</span><span>(</span><span>mod3</span><span>),</span><span>
</span><span>`MICE with Poisson proportional probabilities`</span><span> </span><span>=</span><span> </span><span>coef_mice1</span><span>,</span><span>
</span><span>`MICE with uniform probabilities`</span><span> </span><span>=</span><span> </span><span>coef_mice2</span><span>,</span><span>
</span><span>`MICE with default imputation`</span><span> </span><span>=</span><span> </span><span>coef_mice3</span><span>,</span><span>
</span><span>labels</span><span> </span><span>=</span><span> </span><span>names</span><span>(</span><span>coef</span><span>(</span><span>mod0</span><span>)))</span><span> </span><span>%>%</span><span>
</span><span>mutate</span><span>(</span><span>labels</span><span> </span><span>=</span><span> </span><span>gsub</span><span>(</span><span>&quot;animals&quot;</span><span>,</span><span> </span><span>&quot;&quot;</span><span>,</span><span> </span><span>labels</span><span>),</span><span>
</span><span>labels</span><span> </span><span>=</span><span> </span><span>gsub</span><span>(</span><span>&quot;region&quot;</span><span>,</span><span> </span><span>&quot;&quot;</span><span>,</span><span> </span><span>labels</span><span>))</span><span> </span><span>%>%</span><span>
</span><span>gather</span><span>(</span><span>method</span><span>,</span><span> </span><span>value</span><span>,</span><span> </span><span>-</span><span>underlying</span><span>,</span><span> </span><span>-</span><span>labels</span><span>)</span><span> </span><span>%>%</span><span>
</span><span>mutate</span><span>(</span><span>value</span><span> </span><span>=</span><span> </span><span>ifelse</span><span>(</span><span>is.na</span><span>(</span><span>value</span><span>),</span><span> </span><span>0</span><span>,</span><span> </span><span>value</span><span>))</span><span> </span><span># summary data: </span><span> </span><span>d</span><span>2</span><span> </span><span>&lt;-</span><span> </span><span>d</span><span> </span><span>%>%</span><span>
</span><span># the intercept is on a different scale to all the other coefficients
</span><span> </span><span>filter</span><span>(</span><span>labels</span><span> </span><span>!=</span><span> </span><span>&quot;(Intercept)&quot;</span><span>)</span><span> </span><span>%>%</span><span>
</span><span>mutate</span><span>(</span><span>square_error</span><span> </span><span>=</span><span> </span><span>(</span><span>value</span><span> </span><span>-</span><span> </span><span>underlying</span><span>)</span><span> </span><span>^</span><span> </span><span>2</span><span>)</span><span> </span><span>%>%</span><span>
</span><span>group_by</span><span>(</span><span>method</span><span>)</span><span> </span><span>%>%</span><span>
</span><span>summarise</span><span>(</span><span>mse</span><span> </span><span>=</span><span> </span><span>mean</span><span>(</span><span>square_error</span><span>),</span><span>
</span><span>trmse</span><span> </span><span>=</span><span> </span><span>mean</span><span>(</span><span>square_error</span><span>,</span><span> </span><span>tr</span><span> </span><span>=</span><span> </span><span>0.2</span><span>))</span><span> </span><span>%>%</span><span>
</span><span>ungroup</span><span>()</span><span> </span><span>%>%</span><span>
</span><span>mutate</span><span>(</span><span>method</span><span> </span><span>=</span><span> </span><span>fct_reorder</span><span>(</span><span>method</span><span>,</span><span> </span><span>mse</span><span>))</span><span> </span><span>%>%</span><span>
</span><span>arrange</span><span>(</span><span>trmse</span><span>)</span><span> </span><span>%>%</span><span>
</span><span>mutate</span><span>(</span><span>method</span><span> </span><span>=</span><span> </span><span>fct_reorder</span><span>(</span><span>method</span><span>,</span><span> </span><span>trmse</span><span>))</span><span> </span><span>%>%</span><span>
</span><span>mutate</span><span>(</span><span>run</span><span> </span><span>=</span><span> </span><span>run</span><span>,</span><span>
</span><span>prop_suppressed</span><span> </span><span>=</span><span> </span><span>prop_suppressed</span><span>,</span><span>
</span><span>n</span><span> </span><span>=</span><span> </span><span>n</span><span>)</span><span>
</span><span>if</span><span>(</span><span>output</span><span> </span><span>==</span><span> </span><span>&quot;summary&quot;</span><span>){</span><span>
</span><span>return</span><span>(</span><span>d</span><span>2</span><span>)</span><span> </span><span>}</span><span> </span><span>if</span><span>(</span><span>output</span><span> </span><span>==</span><span> </span><span>&quot;all&quot;</span><span>){</span><span>
</span><span>return</span><span>(</span><span>list</span><span>(</span><span>
</span><span>all_coefficients</span><span> </span><span>=</span><span> </span><span>d</span><span>,</span><span>
</span><span>performance_summary</span><span> </span><span>=</span><span> </span><span>d</span><span>2</span><span>,</span><span>
</span><span>data</span><span> </span><span>=</span><span> </span><span>data</span><span>
</span><span>))</span><span>
</span><span>}</span><span>
</span><span>}</span><span>
</span><span>}</span><span>
</span><span>#--------------------do the runs----------------
# It was useful to do this in a single-threaded way during dev to locate problems such
# as with run 357, but when that was sorted it was better to dso the experiments with # parallel processing.
</span><span>
</span><span># set up cluster with number of cores minus one
</span><span>cores</span><span> </span><span>&lt;-</span><span> </span><span>detectCores</span><span>()</span><span>
</span><span>cluster</span><span> </span><span>&lt;-</span><span> </span><span>makePSOCKcluster</span><span>(</span><span>max</span><span>(</span><span>1</span><span>,</span><span> </span><span>cores</span><span> </span><span>-</span><span> </span><span>1</span><span>))</span><span>
</span><span># set up the functionality on the cluster
</span><span>clusterEvalQ</span><span>(</span><span>cluster</span><span>,</span><span> </span><span>{</span><span>
</span><span>library</span><span>(</span><span>dplyr</span><span>)</span><span>
</span><span>library</span><span>(</span><span>tidyr</span><span>)</span><span>
</span><span>library</span><span>(</span><span>forcats</span><span>)</span><span>
</span><span>library</span><span>(</span><span>mice</span><span>)</span><span>
</span><span>library</span><span>(</span><span>VGAM</span><span>)</span><span>
</span><span>})</span><span>
</span><span>clusterExport</span><span>(</span><span>cluster</span><span>,</span><span> </span><span>c</span><span>(</span><span>&quot;coefs_comp&quot;</span><span>,</span><span> </span><span>&quot;mice.impute.desuppress&quot;</span><span>,</span><span> </span><span>&quot;mice.impute.uniform&quot;</span><span>))</span><span>
</span><span># Generate data for a sequence of seeds and compare the coefficient from the various methods
</span><span>results</span><span> </span><span>&lt;-</span><span> </span><span>parLapply</span><span>(</span><span>cluster</span><span>,</span><span> </span><span>1</span><span>:</span><span>1000</span><span>,</span><span> </span><span>coefs_comp</span><span>)</span><span>
</span><span>stopCluster</span><span>(</span><span>cluster</span><span>)</span><span>
</span><span>#--------------------present results-------------------
</span><span>results_df</span><span> </span><span>&lt;-</span><span> </span><span>do.call</span><span>(</span><span>&quot;rbind&quot;</span><span>,</span><span> </span><span>results</span><span>)</span><span> </span><span>%>%</span><span>
</span><span>mutate</span><span>(</span><span>method</span><span> </span><span>=</span><span> </span><span>fct_reorder</span><span>(</span><span>str_wrap</span><span>(</span><span>method</span><span>,</span><span> </span><span>27</span><span>),</span><span> </span><span>mse</span><span>))</span><span>
</span><span>summary</span><span>(</span><span>results_df</span><span>)</span><span>
</span><span>results_df</span><span> </span><span>%>%</span><span>
</span><span>ggplot</span><span>(</span><span>aes</span><span>(</span><span>x</span><span> </span><span>=</span><span> </span><span>method</span><span>,</span><span> </span><span>y</span><span> </span><span>=</span><span> </span><span>mse</span><span>))</span><span> </span><span>+</span><span>
</span><span>geom_boxplot</span><span>()</span><span> </span><span>+</span><span>
</span><span>scale_y_log10</span><span>()</span><span> </span><span>+</span><span>
</span><span>coord_flip</span><span>()</span><span> </span><span>+</span><span>
</span><span>labs</span><span>(</span><span>y</span><span> </span><span>=</span><span> </span><span>&quot;Mean squared error of coefficients, compared to true data generating process&quot;</span><span>,</span><span>
</span><span>x</span><span> </span><span>=</span><span> </span><span>&quot;&quot;</span><span>)</span><span> </span><span>+</span><span>
</span><span>ggtitle</span><span>(</span><span>&quot;Fitting a Poisson GLM to a cross tab of counts&quot;</span><span>,</span><span>
</span><span>&quot;Comparison of methods of dealing with suppressed counts under 6&quot;</span><span>)</span><span>
</span><span>results_df</span><span> </span><span>%>%</span><span>
</span><span>ggplot</span><span>(</span><span>aes</span><span>(</span><span>x</span><span> </span><span>=</span><span> </span><span>prop_suppressed</span><span>,</span><span> </span><span>y</span><span> </span><span>=</span><span> </span><span>mse</span><span>))</span><span> </span><span>+</span><span>
</span><span>facet_wrap</span><span>(</span><span>~</span><span>method</span><span>)</span><span> </span><span>+</span><span>
</span><span>geom_point</span><span>(</span><span>size</span><span> </span><span>=</span><span> </span><span>0.3</span><span>)</span><span> </span><span>+</span><span>
</span><span>scale_y_log10</span><span>()</span><span> </span><span>+</span><span>
</span><span>geom_smooth</span><span>(</span><span>method</span><span> </span><span>=</span><span> </span><span>&quot;lm&quot;</span><span>)</span><span> </span><span>+</span><span>
</span><span>labs</span><span>(</span><span>y</span><span> </span><span>=</span><span> </span><span>&quot;Mean squared error of coefficients,\ncompared to true data generating process&quot;</span><span>,</span><span>
</span><span>x</span><span> </span><span>=</span><span> </span><span>&quot;Proportion of cells in original data that are under 6&quot;</span><span>)</span><span> </span><span>+</span><span>
</span><span>ggtitle</span><span>(</span><span>&quot;Fitting a Poisson GLM to a cross tab of counts&quot;</span><span>,</span><span>
</span><span>&quot;Comparison of methods of dealing with suppressed counts under 6&quot;</span><span>)</span><span>
</span><span>results_df</span><span> </span><span>%>%</span><span>
</span><span>ggplot</span><span>(</span><span>aes</span><span>(</span><span>x</span><span> </span><span>=</span><span> </span><span>n</span><span>,</span><span> </span><span>y</span><span> </span><span>=</span><span> </span><span>mse</span><span>))</span><span> </span><span>+</span><span>
</span><span>facet_wrap</span><span>(</span><span>~</span><span>method</span><span>)</span><span> </span><span>+</span><span>
</span><span>geom_point</span><span>(</span><span>size</span><span> </span><span>=</span><span> </span><span>0.3</span><span>)</span><span> </span><span>+</span><span>
</span><span>scale_y_log10</span><span>()</span><span> </span><span>+</span><span>
</span><span>geom_smooth</span><span>(</span><span>method</span><span> </span><span>=</span><span> </span><span>&quot;lm&quot;</span><span>)</span><span> </span><span>+</span><span>
</span><span>labs</span><span>(</span><span>y</span><span> </span><span>=</span><span> </span><span>&quot;Mean squared error of coefficients,\ncompared to true data generating process&quot;</span><span>,</span><span>
</span><span>x</span><span> </span><span>=</span><span> </span><span>&quot;Number of coefficients to estimate&quot;</span><span>)</span><span> </span><span>+</span><span>
</span><span>ggtitle</span><span>(</span><span>&quot;Fitting a Poisson GLM to a cross tab of counts&quot;</span><span>,</span><span>
</span><span>&quot;Comparison of methods of dealing with suppressed counts under 6&quot;</span><span>)</span><span>
</span><span>#--------------further investigation----------
</span><span>results_df</span><span> </span><span>%>%</span><span>
</span><span>ggplot</span><span>(</span><span>aes</span><span>(</span><span>x</span><span> </span><span>=</span><span> </span><span>mse</span><span>))</span><span> </span><span>+</span><span>
</span><span>facet_wrap</span><span>(</span><span>~</span><span>method</span><span>)</span><span> </span><span>+</span><span>
</span><span>geom_density</span><span>(</span><span>fill</span><span> </span><span>=</span><span> </span><span>&quot;steelblue&quot;</span><span>,</span><span> </span><span>alpha</span><span> </span><span>=</span><span> </span><span>0.5</span><span>)</span><span> </span><span>+</span><span>
</span><span>scale_x_log10</span><span>(</span><span>label</span><span> </span><span>=</span><span> </span><span>comma</span><span>,</span><span> </span><span>breaks</span><span> </span><span>=</span><span> </span><span>c</span><span>(</span><span>0.1</span><span>,</span><span> </span><span>0.3</span><span>,</span><span> </span><span>1</span><span>,</span><span> </span><span>3</span><span>,</span><span> </span><span>10</span><span>,</span><span> </span><span>100</span><span>))</span><span> </span><span>+</span><span>
</span><span>ggtitle</span><span>(</span><span>&quot;Bimodal distribution of performance when using the real data&quot;</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># which are the really poor performing methods when using the full data?
</span><span>full_data_method</span><span> </span><span>&lt;-</span><span> </span><span>results_df</span><span> </span><span>%>%</span><span>
</span><span>filter</span><span>(</span><span>grepl</span><span>(</span><span>&quot;^Using full data&quot;</span><span>,</span><span> </span><span>method</span><span> </span><span>))</span><span> </span><span>%>%</span><span>
</span><span>arrange</span><span>(</span><span>desc</span><span>(</span><span>mse</span><span>))</span><span>
</span><span>full_data_method</span><span> </span><span>%>%</span><span>
</span><span>ggplot</span><span>(</span><span>aes</span><span>(</span><span>x</span><span> </span><span>=</span><span> </span><span>prop_suppressed</span><span>,</span><span> </span><span>y</span><span> </span><span>=</span><span> </span><span>n</span><span>,</span><span> </span><span>colour</span><span> </span><span>=</span><span> </span><span>mse</span><span> </span><span>></span><span> </span><span>3</span><span>,</span><span> </span><span>size</span><span> </span><span>=</span><span> </span><span>mse</span><span>))</span><span> </span><span>+</span><span>
</span><span>geom_point</span><span>()</span><span> </span><span>+</span><span>
</span><span>labs</span><span>(</span><span>x</span><span> </span><span>=</span><span> </span><span>&quot;Proportion of data that were suppressed as &lt;6&quot;</span><span>,</span><span>
</span><span>y</span><span> </span><span>=</span><span> </span><span>&quot;Number of cells in table&quot;</span><span>,</span><span>
</span><span>size</span><span> </span><span>=</span><span> </span><span>&quot;Mean squared error of coefficients:&quot;</span><span>,</span><span>
</span><span>colour</span><span> </span><span>=</span><span> </span><span>&quot;Unusually large:&quot;</span><span>)</span><span> </span><span>+</span><span>
</span><span>ggtitle</span><span>(</span><span>&quot;Performance of a model with the true underlying data&quot;</span><span>,</span><span>
</span><span>&quot;General success and occasional complete failure to pick the underlying data generating process&quot;</span><span>)</span><span>
</span><span>full_data_method</span><span>
</span><span># some really bad runs are 125, 721, 506, lets look at just one:
</span><span> </span><span>run125</span><span> </span><span>&lt;-</span><span> </span><span>coefs_comp</span><span>(</span><span>125</span><span>,</span><span> </span><span>output</span><span> </span><span>=</span><span> </span><span>&quot;all&quot;</span><span>)</span><span>
</span><span>run125</span><span>$</span><span>data</span><span> </span><span>%>%</span><span>
</span><span>select</span><span>(</span><span>animals</span><span>,</span><span> </span><span>region</span><span>,</span><span> </span><span>count</span><span>,</span><span> </span><span>expected</span><span>)</span><span> </span><span>%>%</span><span>
</span><span>knitr</span><span>::</span><span>kable</span><span>()</span><span>
</span><span>run125</span><span>$</span><span>all_coefficients</span><span> </span><span>%>%</span><span>
</span><span>mutate</span><span>(</span><span>method</span><span> </span><span>=</span><span> </span><span>str_wrap</span><span>(</span><span>method</span><span>,</span><span> </span><span>30</span><span>))</span><span> </span><span>%>%</span><span>
</span><span>ggplot</span><span>(</span><span>aes</span><span>(</span><span>x</span><span> </span><span>=</span><span> </span><span>underlying</span><span>,</span><span> </span><span>y</span><span> </span><span>=</span><span> </span><span>value</span><span>,</span><span> </span><span>label</span><span> </span><span>=</span><span> </span><span>labels</span><span>))</span><span> </span><span>+</span><span>
</span><span>geom_abline</span><span>(</span><span>slope</span><span> </span><span>=</span><span> </span><span>1</span><span>,</span><span> </span><span>intercept</span><span> </span><span>=</span><span> </span><span>0</span><span>)</span><span> </span><span>+</span><span>
</span><span>geom_text</span><span>()</span><span> </span><span>+</span><span>
</span><span>facet_wrap</span><span>(</span><span>~</span><span>method</span><span>)</span><span> </span><span>+</span><span>
</span><span>ggtitle</span><span>(</span><span>&quot;Example of a particularly poorly performing model with the real data&quot;</span><span>,</span><span>
</span><span>&quot;Model run 125;\nMany zeroes in the data mean the GLM estimates are highly unstable&quot;</span><span>)</span><span> </span><span>+</span><span>
</span><span>labs</span><span>(</span><span>x</span><span> </span><span>=</span><span> </span><span>&quot;True value of underlying coefficients&quot;</span><span>,</span><span>
</span><span>y</span><span> </span><span>=</span><span> </span><span>&quot;Estimate from various types of model&quot;</span><span>)</span><span>
</span><span># lots of 25s: </span><span>glm</span><span>(</span><span>count</span><span> </span><span>~</span><span> </span><span>animals</span><span> </span><span>*</span><span> </span><span>region</span><span>,</span><span> </span><span>data</span><span> </span><span>=</span><span> </span><span>run125</span><span>$</span><span>data</span><span>,</span><span> </span><span>family</span><span> </span><span>=</span><span> </span><span>&quot;poisson&quot;</span><span>)</span></code></pre>
</figure>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://freerangestats.info/blog/2018/11/18/suppressed-data-2"> free range statistics - 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 rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/E7lQKqzKQbI" height="1"></a></div>