楼主: 陈超123
6615 5

[学习分享] R mgcv GAM画图 计算RR [推广有奖]

  • 1关注
  • 1粉丝

博士生

44%

还不是VIP/贵宾

-

威望
0
论坛币
828 个
通用积分
3.8700
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
2334 点
帖子
82
精华
0
在线时间
394 小时
注册时间
2015-4-6
最后登录
2024-3-18

10论坛币
请问各位大神,我现在想用R mgcv包做GAM,广义加性模型。我的数据资料是每个病例信息,以及所各自对应的pm2.5暴露,要研究这种疾病与空气暴露的关系。请问,mgcv如何做这种图,并且输出的是RR值(相对危险度)!

205947dn1d22ala6llrmm0.png (56.73 KB)

205947dn1d22ala6llrmm0.png

关键词:GAM 广义加性模型 数据资料 危险度 mgcv GAM画图 计算RR
沙发
陈超123 学生认证  发表于 2017-10-31 19:32:50 |只看作者 |坛友微信交流群
纵坐标是RR值,而不是s(x)!

使用道具

藤椅
1646010020 发表于 2018-1-19 17:23:08 |只看作者 |坛友微信交流群
您好  我想和您交流怎么做GAM  请您加我QQ 2027660071 谢谢

使用道具

板凳
好好努力116 发表于 2018-11-15 23:06:35 |只看作者 |坛友微信交流群
请问怎么解决?急求~

使用道具

报纸
慢蜗蜗 发表于 2019-1-6 22:15:18 |只看作者 |坛友微信交流群
陈超123 发表于 2017-10-31 19:32
纵坐标是RR值,而不是s(x)!
你好,请问您的问题解决了吗?我也想知道如何求RR

使用道具

地板
caimiao0714 学生认证  发表于 2019-1-7 08:57:49 |只看作者 |坛友微信交流群
  1. library(epiR) # Used for Risk ratio
  2. library(MASS) # Used for data

  3. dat1 <- birthwt; head(dat1)

  4. ## Generate a table of cell frequencies. First set the levels of the outcome
  5. ## and the exposure so the frequencies in the 2 by 2 table come out in the
  6. ## conventional format:
  7. dat1$low <- factor(dat1$low, levels = c(1,0))
  8. dat1$smoke <- factor(dat1$smoke, levels = c(1,0))
  9. dat1$race <- factor(dat1$race, levels = c(1,2,3))
  10. ## Generate the 2 by 2 table. Exposure (rows) = smoke. Outcome (columns) = low.
  11. tab1 <- table(dat1$smoke, dat1$low, dnn = c("Smoke", "Low BW"))
  12. print(tab1)
  13. ## Compute the incidence risk ratio and other measures of association:
  14. epi.2by2(dat = tab1, method = "cohort.count",
  15. conf.level = 0.95, units = 100, outcome = "as.columns")
复制代码


源答案见这里:
https://stats.stackexchange.com/questions/180135/calculating-a-risk-ratio-for-specific-x-values-from-a-gam-model-using-the-mgcv-p

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-4-20 03:53