关于 R 中未加权 ANES 调查的问题
Question about unweighted ANES survey in R
这可能更像是一个统计问题。我正在尝试使用 2016 年 ANES 调查来理解 R 中未加权的频率。我使用 anesr
下载了数据,并且正在使用 Anthony Damico 关于 lodown
的教科书:http://asdfree.com/american-national-election-study-anes.html
ANES 指南:https://electionstudies.org/wp-content/uploads/2018/12/anes_timeseries_2016_userguidecodebook.pdf
ANES 是一项小组调查,包含选举前采访和 post 选举采访。
抱歉,我无法 post 基础数据。但本质上,我试图理解一个问题。
假设我想获得对 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
这与第一个 table 中的输出不匹配,即使它们都未加权。似乎 svyby 函数只包括在选举前和 post 选举调查中的观察结果,但问题只在选举前调查中。
当我使用 V160101
(仅限选举前)而不是 V160202
重新 运行 分析时,输出匹配...那么最好使用哪个?
因为您使用的是 post-选举权重变量,对于不在 post-选举调查中的人来说,该变量缺失(或可能为零),您只会得到观察结果在两项调查中。
这可能更像是一个统计问题。我正在尝试使用 2016 年 ANES 调查来理解 R 中未加权的频率。我使用 anesr
下载了数据,并且正在使用 Anthony Damico 关于 lodown
的教科书:http://asdfree.com/american-national-election-study-anes.html
ANES 指南:https://electionstudies.org/wp-content/uploads/2018/12/anes_timeseries_2016_userguidecodebook.pdf
ANES 是一项小组调查,包含选举前采访和 post 选举采访。
抱歉,我无法 post 基础数据。但本质上,我试图理解一个问题。
假设我想获得对 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
这与第一个 table 中的输出不匹配,即使它们都未加权。似乎 svyby 函数只包括在选举前和 post 选举调查中的观察结果,但问题只在选举前调查中。
当我使用 V160101
(仅限选举前)而不是 V160202
重新 运行 分析时,输出匹配...那么最好使用哪个?
因为您使用的是 post-选举权重变量,对于不在 post-选举调查中的人来说,该变量缺失(或可能为零),您只会得到观察结果在两项调查中。