且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

R中具有稳健聚类标准误差的逻辑回归

更新时间:2021-12-14 10:27:28

您可能需要查看 rms(回归建模策略)包.所以,lrm 是逻辑回归模型,如果 fit 是你的输出名称,你会有这样的东西:

You might want to look at the rms (regression modelling strategies) package. So, lrm is logistic regression model, and if fit is the name of your output, you'd have something like this:

fit=lrm(disease ~ age + study + rcs(bmi,3), x=T, y=T, data=dataf)

fit

robcov(fit, cluster=dataf$id)

bootcov(fit,cluster=dataf$id)

您必须在模型语句中指定x=T, y=T.rcs 表示具有 3 节的受限三次样条.

You have to specify x=T, y=T in the model statement. rcs indicates restricted cubic splines with 3 knots.