title: Using "adjust" option for lonely PSUs in R survey package: why don't single-PSU strata variances change when data in other strata change?
body: <p>I have survey data from a stratified simple random sampling design where some strata contain only a single sampling unit (even though the strata population size may be >1).  These are referred to as "lonely PSUs" in the R survey package (<a href="http://r-survey.r-forge.r-project.org/survey/exmample-lonely.html" rel="noreferrer">http://r-survey.r-forge.r-project.org/survey/exmample-lonely.html</a>).  There are several options for dealing with this situation and the one I'm interested in is the "adjust" option.  </p>
  
  <p>The documentation for <code>options(survey.lonely.psu="adjust")</code> states that </p>
  
  <blockquote>
    <p>"the data for the single-PSU stratum are centered at the sample grand
    mean rather than the stratum mean."</p>
  </blockquote>
  
  <p>In experimenting with this option I had expected that the variance for my single-PSU stratum would change if I changed the data in another stratum but that wasn't the case.  Here is a small example:</p>
  
  <pre><code>library(survey)
  options(survey.lonely.psu="adjust")
  
  # sample 1
  dat1 &lt;- data.frame(N = c(3, 3, 2), h = c(1, 1, 2), y = c(2, 6, 15))
  survey1 &lt;- svydesign(~1, fpc = ~N, strata = ~h, data = dat1)
  svyby(~y, by = ~h, design = survey1, FUN = svytotal)
  </code></pre>
  
  <p>In the results note the standard error for strata 2, which is the single-PSU stratum:</p>
  
  <pre><code>  h  y        se
  1 1 12  3.464102
  2 2 30 21.213203
  </code></pre>
  
  <p>Now if I change the data in strata 1 like so</p>
  
  <pre><code># sample 2
  (dat2 &lt;- data.frame(N = c(3, 3, 2), h = c(1, 1, 2), y = c(200, 600, 15)))
  (survey2 &lt;- svydesign(~1, fpc = ~N, strata = ~h, data = dat2))
  svyby(~y, by = ~h, design = survey2, FUN = svytotal)
  </code></pre>
  
  <p>The results change as expected for stratum 1, but the standard error is still the same for stratum 2</p>
  
  <pre><code>  h    y       se
  1 1 1200 346.4102
  2 2   30  21.2132
  </code></pre>
  
  <p>Am I mis-interpreting what the documentation means or might this be a bug?</p>
  
  <p>FYI, here is my sessionInfo:</p>
  
  <pre><code>R version 3.1.3 (2015-03-09)
  Platform: i386-w64-mingw32/i386 (32-bit)
  Running under: Windows 7 x64 (build 7601) Service Pack 1
  other attached packages:
  [1] survey_3.30-3
  </code></pre>
  
  <p><strong>EDIT</strong></p>
  
  <p>My interpretation of the initial answers I received was that the variance adjustment doesn't take effect when the data are subset using the <code>svyby</code> function.  However, when I compare the variances of the totals for the stratified population with the variance for the total population it appears that, just as when there are no lonely PSUs, the variance of the total is simply the variance of the independently sampled stratum variances:</p>
  
  <pre><code>&gt; vcov(svyby(~y, by = ~h, design = survey1, FUN = svytotal))
     1   2
  1 12   0
  2  0 450
  
  &gt; vcov(svytotal(~y, survey1))
      y
  y 462
  </code></pre>
  
  <p>It seems that the latter variance should be different if there is some sort of centering to the grand mean going on when all the data are combined.</p>
  
  <p>As a related question, here is a comparison of <code>svyby</code> when estimating means versus totals:</p>
  
  <pre><code>&gt; svyby(~y, by = ~h, design = survey1, FUN = svymean)
    h  y    se
  1 1  4 1.155
  2 2 15 0.000
  
  &gt; svyby(~y, by = ~h, design = survey1, FUN = svytotal)
    h  y     se
  1 1 12  3.464
  2 2 30 21.213
  </code></pre>
  
  <p>I'm confused here as to why there is a variance estimated for stratum 2 (which contains a lonley PSU) when estimating a total but not when estimating a mean. </p>