在R中检验多分类有序因变量的有序逻辑回归比例优势假设
多分类有序因变量的比例优势假设检验问题
我使用R中MASS包的polr()函数,针对一个按休闲天数分组的8分类有序因变量,以分类变量BIPOC(是/否)和连续变量城市性得分(urbanicity score)为自变量构建有序逻辑回归模型,代码如下:
polr(days ~ urbanicity*BIPOC, data = dat1, Hess = T)
我无法确定如何检验该模型是否满足比例优势假设。已知Brant检验等统计检验过于严格,因此尝试采用图形化检验方法,但网上多数示例仅针对3分类因变量,只需比较两个不同截断点的二项模型。请问如何将这类检验适配到分类数>3的场景?
我目前的临时解决方案是运行一系列二项模型并比较系数,但难以判断系数差异达到何种程度时可认为假设被违反,希望获得其他解决方案。临时方案代码如下:
m.res <- list() for (i in 2:8){ # 基于截断点创建二分类变量 dat$x <- ifelse(as.numeric(dat$days) < i, 0, 1) # 拟合对应截断点的二项模型 m <- glm( x ~ urbanicity*BIPOC, data = dat, family = "binomial" ) # 将模型结果存入列表 m.res[[i-1]] <- m } coefficient_comparison <- data.frame(matrix(nrow=0, ncol=7,)) colnames(coefficient_comparison) <- c("y>1", "y>2", "y>3", "y>4", "y>5", "y>6", "y>7") coefficient_comparison <- data.frame( oneplus = summary(m.res[[1]])$coefficients[ , "Estimate"], twoplus = summary(m.res[[2]])$coefficients[ , "Estimate"], threeplus = summary(m.res[[3]])$coefficients[ , "Estimate"], fourplus = summary(m.res[[4]])$coefficients[ , "Estimate"], fiveplus = summary(m.res[[5]])$coefficients[ , "Estimate"], sixplus = summary(m.res[[6]])$coefficients[ , "Estimate"], sevenplus = summary(m.res[[7]])$coefficients[ , "Estimate"] ) coefficient_comparison
运行上述代码后得到各二项模型的系数表:
oneplus twoplus threeplus fourplus fiveplus sixplus sevenplus (Intercept) 3.2413652 0.6931362 0.2917739 -0.01815633 -0.2713922 -0.4564793 -0.6188225 urbanicity -1.2027440 -1.0300582 -1.2566895 -1.34407778 -1.4980431 -1.6129901 -1.7764729 BIPOC1 -0.7400516 -0.7444939 -0.8024623 -0.85788852 -0.8748921 -0.8564442 -0.8467173 urbanic:BIPOC1 1.2562572 0.8580332 0.6188747 0.47969936 0.3371632 0.2803162 0.1873982
内容的提问来源于stack exchange,提问作者KL_47
相关产品推荐
相关产品推荐

