<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/small-area-estimation-101/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://hagutierrezro.blogspot.com/2017/04/small-area-estimation-101.html"> Data Literacy - The blog of Andrés Gutiérrez</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>Small area estimation (SAE) has become a widely used technique in official statistics since the last decade of past century. When the sample size is not enough to provide reliable estimates at a very particular level, the power of models and auxiliary information must be applied with no hesitation. In a nutshell, SAE tries to exploits similarity and borrows strength from available information.</p>
<p>I will write some posts to present, step by step, the fundamentals of SAE and how it can be implemented in the R software. The first post (this one you are reading now) is about basic concepts such as sampling and databases, the second and third posts will deal with direct and indirect estimates, respectively; the fourth post will introduce model-assisted estimation; and finally, the fifth post will deal with the Fay-Harriot method.</p>
<p>Let’s begin. First of all, The Australian Bureau of Statistics declares that small area estimation refers to methods of producing sufficiently reliable estimates for geographic areas that are too fine to obtain with precision, using direct survey estimation methods. By direct estimation, we mean classical design-based survey estimation methods that utilize only the sample units contained in each small area. Small area estimation methods are used to overcome the problem of small samples sizes to produce small area estimates that improve the quality of direct survey estimates obtained from the sample in each small area. The more sophisticated of these methods work by taking advantage of various relationships in the data, and involve, either implicitly or explicitly, a statistical model to describe these relationships.</p>
<p>Now, I want to reproduce a clarifying explanation from Dr. Little (paraphrasing Groves) about SAE, and its use in survey sampling. They claim that <strong><span><em>regression estimates</em></span></strong> provide <strong><span><em>relatively precise predictions</em></span></strong> for small areas from a survey that account for the differences between areas of characteristics included as predictors in the survey but do not account for differences in characteristics not included in the study. <strong><span><em>Direct estimates</em></span></strong> for each area are unique to the area and hence take into account both observed and unobserved relevant characteristics; however, they have <strong><span><em>low precision in areas where the sample size is small</em></span></strong>. The <strong><span><em>SAE model</em></span></strong> combines the regression estimate and direct estimate for each area in a sensible way, <strong><span><em>balancing bias and precision</em></span></strong>.</p>
<p>For this technique to succeeds, Longford 2005 claims that areas that are known to be similar to one another should be receiving similar estimates, rather than estimates independent of one another. The degree to which similarity can or should be imposed can be chosen from statistical grounds by minimizing the overall discrepancy (mean squared error).</p>
<p>Rahman 2008 emphasizes that SAE uses data from similar domains to estimate the statistics in a particular small area of interest, and this ‘borrowing of strength’ is justified by assuming a model which relates the small area statistics. SAE is the process of using statistical models to link survey outcome or response variables to a set of predictor variables known for small areas to predict small area-level estimates. Traditional area-specific estimates may not provide enough statistical precision because of small sample observations in small geographical regions. In such situation, it may be worth checking whether it is possible to use indirect estimation approaches based on the linking models.</p>
<h2>R workshop</h2>
<p>This code will not produce any small area estimation, but it will help to introduce basic concepts of sampling. We will use the <strong>BigLucy</strong> database from the <strong>TeachingSampling</strong> package to illustrate how to obtain a probabilistic sample from a finite population. This database is about deals with some economic variables for a population of 85296 companies spread out into 100 <span>counties</span> (areas) in a particular year of some fake country. The aim of the exercise is 1) to select a stratified sample according to the size of the companies and 2) obtain accurate estimates of the total income within each of the 100 counties. Note that the parameters of interest are given by:</p>
<p>$$t_{y,d} = \sum_{k \in U_d} y_k$$</p>
<p>Where $t_{y,d}$ denotes the total income of the $d$-th county, $y_k$ is the income of the $k$-th company belonging the $d$-th county. The whole population of companies into the county is noted by $U_d$. Thus, this code computes the total income for each county along with the number of companies belonging each county. Finally, this parameters are saved in a new database named <strong>Results</strong>. </p>
<pre><span>#############################</span><br><span>##### Setting things up #####</span><br><span>#############################</span><br><br>setwd(<span>“/wherever your prefer location is&quot;</span>)<br><br>rm(<span>list</span> <span>=</span> ls())<br>set.seed(<span>2017</span>)<br>library(<span>TeachingSampling</span>)<br>library(<span>dplyr</span>)<br>data(<span>&quot;BigLucy&quot;</span>)<br><br>summary(<span>BigLucy</span><span>$</span><span>Level</span>)<br>levels(<span>BigLucy</span><span>$</span><span>Zone</span>)<br><br><span>Total</span> <span>&lt;-</span> <span>BigLucy</span> %<span>></span>%<br>  group_by(<span>Zone</span>) %<span>></span>%<br>  summarise(<span>Income.</span> <span>=</span> sum(<span>Income</span>)) %<span>></span>%<br>  arrange(<span>Zone</span>)<br><br><span>N</span> <span>&lt;-</span> <span>BigLucy</span> %<span>></span>%<br>  group_by(<span>Zone</span>) %<span>></span>%<br>  summarise(<span>N.county</span> <span>=</span> n()) %<span>></span>%<br>  arrange(<span>Zone</span>)<br><br><span>Results</span> <span>&lt;-</span> <span>data.frame</span>(<span>N</span>, <span>Total</span><span>$</span><span>Income</span>.)<br><br><span>#Checking the population total</span><br>(<span>Total</span> <span>&lt;-</span> sum(<span>Results</span><span>$</span><span>Total.Income</span>.))<br><br></pre>
<p>Now, once the parameters of the finite populations are computed, the time has come for us to select a sample. The sampling design we will use is an stratified sampling by taking advantage of the classification of each company into the database according to its level: small, medium and large. The selected sample will be stored into an object named <strong>data.sample</strong> and the sampling weights will be saved in another object called <strong>FEX</strong>.</p>
<pre><span>#######################################</span><br><span>##### Drawing a stratified sample #####</span><br><span>#######################################</span><br><br><span># Level is the stratifying variable</span><br>summary(<span>BigLucy</span><span>$</span><span>Level</span>)<br>attach(<span>BigLucy</span>)<br><span># Defines the size of each stratum</span><br><span>N1</span> <span>&lt;-</span> summary(<span>Level</span>)[[<span>1</span>]]<br><span>N2</span> <span>&lt;-</span> summary(<span>Level</span>)[[<span>2</span>]]<br><span>N3</span> <span>&lt;-</span> summary(<span>Level</span>)[[<span>3</span>]]<br><span>N1</span>;<span>N2</span>;<span>N3</span><br><span>Nh</span> <span>&lt;-</span> c(<span>N1</span>,<span>N2</span>,<span>N3</span>)<br><span># Defines the sample size at each stratum</span><br><br><span>n1</span> <span>&lt;-</span> round(<span>N1</span> <span>*</span> <span>0.05</span>)<br><span>n2</span> <span>&lt;-</span> round(<span>N2</span> <span>*</span> <span>0.05</span>)<br><span>n3</span> <span>&lt;-</span> round(<span>N3</span> <span>*</span> <span>0.05</span>)<br>(<span>nh</span><span>&lt;-</span>c(<span>n1</span>,<span>n2</span>,<span>n3</span>))<br><span># Draws a stratified sample</span><br><span>sam</span> <span>&lt;-</span> S.STSI(<span>Level</span>, <span>Nh</span>, <span>nh</span>)<br><br><span>data.sam</span> <span>&lt;-</span> <span>BigLucy</span>[<span>sam</span>,]<br><br><span>data.sam</span><span>$</span><span>FEX</span> <span>&lt;-</span> <span>NULL</span><br><span>data.sam</span><span>$</span><span>FEX</span>[<span>data.sam</span><span>$</span><span>Level</span> <span>=</span><span>=</span> <span>&quot;Big&quot;</span>] <span>&lt;-</span> <span>Nh</span>[<span>1</span>] <span>/</span> <span>nh</span>[<span>1</span>]<br><span>data.sam</span><span>$</span><span>FEX</span>[<span>data.sam</span><span>$</span><span>Level</span> <span>=</span><span>=</span> <span>&quot;Medium&quot;</span>] <span>&lt;-</span> <span>Nh</span>[<span>2</span>] <span>/</span> <span>nh</span>[<span>2</span>]<br><span>data.sam</span><span>$</span><span>FEX</span>[<span>data.sam</span><span>$</span><span>Level</span> <span>=</span><span>=</span> <span>&quot;Small&quot;</span>] <span>&lt;-</span> <span>Nh</span>[<span>3</span>] <span>/</span> <span>nh</span>[<span>3</span>]<br><br>dim(<span>data.sam</span>)<br>save(<span>data.sam</span>, <span>file</span> <span>=</span> <span>&quot;data.sam.RData&quot;</span>)<br><br></pre>
<p>In summary, we have drawn a sample of 4265 companies: 145 big companies, 1290 medium companies and, 2830 small companies. Each of these companies is spread out through the 100 counties in the country. In the <strong>Results</strong> database will be stored the information about those counties (how many companies are in each county and, how many companies are in the sample for each county.) along with different estimations for the total income of the counties. </p>
<pre><span>######################</span><br><span>##### In summary #####</span><br><span>######################</span><br><br><span>n</span> <span>&lt;-</span> <span>data.sam</span> %<span>></span>%<br>  group_by(<span>Zone</span>) %<span>></span>%<br>  summarise(<span>n.county</span> <span>=</span> n()) %<span>></span>%<br>  arrange(<span>Zone</span>)<br><br><span>Results</span><span>$</span><span>n.county</span> <span>&lt;-</span> <span>n</span><span>$</span><span>n.county</span><br><span>Results</span> <span>&lt;-</span> <span>Results</span>[c(<span>&quot;Zone&quot;</span>, <span>&quot;N.county&quot;</span>, <span>&quot;n.county&quot;</span>, <span>&quot;Total.Income.&quot;</span>)]<br><br>save(<span>Results</span>, <span>file</span> <span>=</span> <span>&quot;Results.RData&quot;</span>)<br></pre>
<p>In the following post, we will use this sample to estimate the total income for each of the hundred zones in BigLucy’s population. </p>
<p> </p>
<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://hagutierrezro.blogspot.com/2017/04/small-area-estimation-101.html"> Data Literacy - The blog of Andrés Gutiérrez</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/WsmBEfV92Ws"></a></div>