假设我有这个数据集:
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
我有理由相信,如果使用权重,结果将会大不相同。
答案 0 :(得分:0)
有人需要修改validate.lrm
包中predab.resample
和rms
的代码。代码位于https://github.com/harrelfe/rms