如何在没有忽略权重的函数的情况下运行有序逻辑回归?

时间:2015-12-04 09:57:17

标签: r regression logistic-regression non-linear-regression

假设我有这个数据集:

require(rms)

newdata <- data.frame(eduattain = rep(c(1,2,3), times=2), dadedu=rep(c(1,2,3),each=2),
                      random=rnorm(6, mean(1000),sd=50))

我将依赖变量和自变量都转换为因子

newdata$eduattain <- factor(newdata$eduattain, levels = 1:3, labels = c("L1","L2","L3"),
                            ordered = T)
newdata$dadedu <- factor(newdata$dadedu, levels = 1:3, labels = c("L1","L2","L3"))

并使用权重进行简单的序数逻辑回归:

model1 <- lrm(eduattain ~ dadedu, data=newdata, weights = random, normwt = T)

警告讯息:

In lrm(eduattain ~ dadedu, data = newdata, weights = random, normwt = T) :
  currently weights are ignored in model validation and bootstrapping lrm fits

我有理由相信,如果使用权重,结果将会大不相同。

我该如何解决?解决此警告的大多数问题都不能对此特定警告给出正确答案。(hereherehere

1 个答案:

答案 0 :(得分:0)

有人需要修改validate.lrm包中predab.resamplerms的代码。代码位于https://github.com/harrelfe/rms

的github上