全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
1842 0
2019-10-01
因为需要对分类变量不同组别的效应进行作图比较,用到qvcalc函数(回归分析中分类变量中各组通常只与参照组对比)。
按help中的例子用glm来做是没有问题的,数据集为R包里的"ships":
复制代码

但是用比例风险模型时总是报错,因变量是factor类型,不知道哪里出了问题:
Error in if (n <= 2) stop("qvcalc works only for factors with 3 or more levels") :
  参数长度为零
数据集为R包里的"veteran":
复制代码
ships & veteran.zip
大小:(2.98 KB)

 马上下载

本附件包括:

  • veteran.csv
  • ships.csv



不同文献都提到qvcalc函数可以应用于比例风险模型:
The function qvcalc may be appliedto R objects of class lm (linear regressions), glm (generalized linear models), polr (orderedlogit or ‘proportional odds’ models), coxph (proportional hazards models), survreg (parametric survival models), gls (linear models fit by generalized least squares), lme (linearmixed-effect models, e.g., for hierarchical and longitudinal data) and others.

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群