gpt4 book ai didi

r - 对 R 调查包 : why don't single-PSU strata variances change when data in other strata change? 中的孤独 PSU 使用 "adjust"选项

转载 作者:行者123 更新时间:2023-12-03 19:38:16 27 4
gpt4 key购买 nike

我有来自分层简单随机抽样设计的调查数据,其中某些层仅包含一个抽样单位(即使层人口规模可能大于 1)。这些在 R 调查包 ( http://r-survey.r-forge.r-project.org/survey/exmample-lonely.html ) 中被称为“孤独的 PSU”。处理这种情况有多种选择,我感兴趣的是“调整”选项。
options(survey.lonely.psu="adjust") 的文档指出

"the data for the single-PSU stratum are centered at the sample grand mean rather than the stratum mean."



在试验此选项时,我曾预计如果我更改另一个层中的数据,我的单 PSU 层的方差会发生变化,但事实并非如此。这是一个小例子:
library(survey)
options(survey.lonely.psu="adjust")

# sample 1
dat1 <- data.frame(N = c(3, 3, 2), h = c(1, 1, 2), y = c(2, 6, 15))
survey1 <- svydesign(~1, fpc = ~N, strata = ~h, data = dat1)
svyby(~y, by = ~h, design = survey1, FUN = svytotal)

在结果中,请注意第 2 层(即单 PSU 层)的标准误差:
  h  y        se
1 1 12 3.464102
2 2 30 21.213203

现在,如果我像这样更改第 1 层中的数据
# sample 2
(dat2 <- data.frame(N = c(3, 3, 2), h = c(1, 1, 2), y = c(200, 600, 15)))
(survey2 <- svydesign(~1, fpc = ~N, strata = ~h, data = dat2))
svyby(~y, by = ~h, design = survey2, FUN = svytotal)

第 1 层的结果发生了变化,但第 2 层的标准误仍然相同
  h    y       se
1 1 1200 346.4102
2 2 30 21.2132

我是否误解了文档的含义,或者这可能是一个错误?

仅供引用,这是我的 sessionInfo:
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

编辑

我对收到的初始答案的解释是,当数据是使用 svyby 的子集时,方差调整不会生效。功能。但是,当我将分层总体的总方差与总总体的方差进行比较时,似乎就像没有单独的初级抽样单位一样,总方差只是独立采样的层方差的方差:
> vcov(svyby(~y, by = ~h, design = survey1, FUN = svytotal))
1 2
1 12 0
2 0 450

> vcov(svytotal(~y, survey1))
y
y 462

如果在合并所有数据时存在某种以总均值为中心的情况,则后者的方差似乎应该有所不同。

作为相关问题,这里是 svyby的比较在估算均值与总计时:
> svyby(~y, by = ~h, design = survey1, FUN = svymean)
h y se
1 1 4 1.155
2 2 15 0.000

> svyby(~y, by = ~h, design = survey1, FUN = svytotal)
h y se
1 1 12 3.464
2 2 30 21.213

我在这里很困惑,为什么在估计总数时会为第 2 层(其中包含一个 lonley PSU)估计方差,但在估计平均值时却没有。

最佳答案

对复杂设计子集的分析基本上等同于将子集外观测的抽样权重设置为零的分析。这意味着这些观察结果不属于“大均值”。

关于r - 对 R 调查包 : why don't single-PSU strata variances change when data in other strata change? 中的孤独 PSU 使用 "adjust"选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32533677/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com