如何对倾斜数据使用序数回归(svyolr)?

How to use ordinal regression (svyolr) with raked data?

使用 survey 包分析序数数据时,我在尝试使用倾斜数据时遇到了一些问题。没有 raking,svyolr() 工作没有任何问题,但是当我在 raking 之后尝试分析时,svyolr 遇到错误 Error in if (any(y < 0 | y > 1)) stop("y values must be 0 <= y <= 1") : missing value where TRUE/FALSE needed

问题可以用示例数据集重现api:

library(survey)
data(api)
dclus1 <- svydesign(id=~dnum, weights=~pw, data=apiclus1, fpc=~fpc)

dclus1<-update(dclus1, mealcat=cut(meals,c(0,25,50,75,100)))

m<-svyolr(mealcat~avg.ed+mobility+stype, design=dclus1)
m #works without a problem

## population marginal totals for each stratum
pop.types <- data.frame(stype=c("E","H","M"), Freq=c(4421,755,1018))
pop.schwide <- data.frame(sch.wide=c("No","Yes"), Freq=c(1072,5122))


## Rake with the population totals
dclus1r<-rake(dclus1, list(~stype,~sch.wide), list(pop.types, pop.schwide))


m2 <-svyolr(mealcat~avg.ed+mobility+stype, design=dclus1r)
m2 # error encountered

我是不是做错了什么? svyolr 不能处理倾斜或后分层(相同的错误消息)数据吗?我在帮助文件中没有看到任何提及,甚至在 survey:::svyolr.survey.design2.

的代码中找不到 if 条件或错误消息

是否可以使用 surveyR 中的任何其他包来执行此操作?

您实际上发现了一个错误 :-) 4.2 版已修复此问题。您可以使用 survey 软件包的开发版本,直到通过 install.packages("survey", repos="http://R-Forge.R-project.org")[= 安装更新进入 CRAN 12=]