【发布时间】:2020-11-30 17:08:58
【问题描述】:
这可能更像是一个统计问题。我正在尝试使用 2016 ANES 调查来了解 R 中的未加权频率。我使用anesr 下载了数据,并正在使用lodown 上的Anthony Damico 教科书:http://asdfree.com/american-national-election-study-anes.html
ANES 指南:https://electionstudies.org/wp-content/uploads/2018/12/anes_timeseries_2016_userguidecodebook.pdf
ANES 是一项小组调查,包括选举前和选举后的访谈。
抱歉,我无法发布基础数据。但本质上,我试图理解一个问题。
假设我想获得对 V161195x 的回复的未加权计数,它总结了对非法带到美国的儿童应该如何处理的看法。使用未加权的数据框,我运行:
table(anes_df$V161195x)
Yielding:
-9 -8 1 2 3 4 5 6
47 29 329 332 112 435 1437 1549
-9 和 -8 被拒绝回答或 N/A。
然后我使用survey 包进行复杂的样本调查设计和更易于阅读的输出。
anes_design <-
svydesign(
~V160202, # full sample weight
strata = ~V160201,
data = anes_df ,
weights = ~V160102 , # full sample weight
nest = TRUE
)
anes_design <-
update(
anes_design,
one = 1, # dummy 1 for each record
undoc_kids =
factor(V161195x , levels = 1:6 , labels =
c( 'should sent back - favor a great deal' ,
'should sent back - favor a moderate amount' ,
'should sent back - favor a little' ,
'should allow to stay - favor a little' ,
'should allow to stay - favor a moderate amount' ,
'should allow to stay - favor a great deal' )
)
)
svyby( ~ one , ~ undoc_kids , anes_design , unwtd.count )
# yields
should sent back - favor a great deal should sent back - favor a great deal 270 0
should sent back - favor a moderate amount should sent back - favor a moderate amount 292 0
should sent back - favor a little should sent back - favor a little 102 0
should allow to stay - favor a little should allow to stay - favor a little 361 0
should allow to stay - favor a moderate amount should allow to stay - favor a moderate amount 1216 0
should allow to stay - favor a great deal should allow to stay - favor a great deal 1348 0
这与第一个表中的输出不匹配,即使它们都未加权。似乎 svyby 函数仅包括在选举前和选举后调查中的观察结果,但问题仅在选举前调查中。
当我使用V160101(仅限预选)而不是V160202 重新运行分析时,输出匹配...那么最好使用哪个?
【问题讨论】: