R 分段测量设计中的几个问题

R 分段测量设计中的几个问题,r,subset,survey,R,Subset,Survey,我使用的是巴西IBGE的PNS微观数据(可在此处获得:) 我使用数据库中现有的变量创建了一些新变量,然后使用下面的代码创建了一个调查设计 pes_all_des <- survey::svydesign( id = ~ upa_pns , strata = ~ v0024 , data = base , weights = ~ pre_pes_full , nest = TRUE ) post_pop_all <- unique

我使用的是巴西IBGE的PNS微观数据(可在此处获得:)

我使用数据库中现有的变量创建了一些新变量,然后使用下面的代码创建了一个调查设计

pes_all_des <-
  survey::svydesign(
    id = ~ upa_pns ,
    strata = ~ v0024 , 
    data = base , 
    weights = ~ pre_pes_full , 
    nest = TRUE
  )

post_pop_all <- unique( base[ , c( 'v00283.y' , 'v00282.y' ) ] )

names( post_pop_all ) <- c( "v00283.y" , "Freq" )

match.design <- survey::postStratify( pes_all_des , ~ v00283.y , post_pop_all )
使用
svyglm()

1: In summary.glm(g) :
  observations with zero weight not used for calculating dispersion
2: In summary.glm(glm.object) :
  observations with zero weight not used for calculating dispersion
这个信息实际上意味着什么?它并没有阻止我运行回归,所以我不知道我应该对此关注多少

更多信息,如果在两种设计中都使用do a summary(),我会得到完全不同的结果:

summary(match.design)
Stratified 1 - level Cluster Sampling design (with replacement)
With (6062) clusters.
survey::postStratify(pes_all_des, ~v00283.y, post_pop_all)
Probabilities:
     Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
0.0000733 0.0008510 0.0018686 0.0033423 0.0036237 0.1058348 

> summary(match.design2)
Stratified 1 - level Cluster Sampling design (with replacement)
With (6062) clusters.
subset(match.design, d_match == 1)
Probabilities:
     Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
0.0001152       Inf       Inf       Inf       Inf       Inf 
有人能帮我吗?提前谢谢


Wagner

这种行为是因为
调查
软件包试图帮助您避免犯统计错误

对于涉及校准/后分层/耙取的特别复杂的设计,子总体(在本例中为
子集(match.design,d_match==1)
)的估计值不能简单地通过从感兴趣的子总体外部过滤数据来计算;这种做法

因此,为了避免您遇到这个统计问题,
调查
软件包不允许您完全删除感兴趣子集之外的记录。相反,它本质上会注意到要忽略哪些行,然后将概率权重调整为有效的零。见本问题:

实现零权重的方法是更新存储在
match.design2$prob
(案例权重的数字向量)中的权重值。该向量中对应于数据中删除行的条目被更改为
Inf
(令人困惑的是,
Inf
表示权重为零)

这就是为什么您会在包含的输出中看到以下权重摘要:

Probabilities:
     Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
0.0001152       Inf       Inf       Inf       Inf       Inf 

我不确定这是否会引起使用
svy.glm

的问题,多重共线性是否会导致这种情况?我不这么认为,@RomanLuštrik。正如您所看到的,子集过程存在一些问题。无论我使用什么变量,回归都会显示这些警告。
Probabilities:
     Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
0.0001152       Inf       Inf       Inf       Inf       Inf