公卫人

 找回密码
 立即注册

QQ登录

只需一步,快速开始

不劳无获:如何获取钢镚? 因为论坛,所以相逢。 捐赠百科答题至尊

公卫考研:一起风雨兼程 因为梦想,所以努力。 真题答案政治英语

职称考试:诸君逢考必过 因为热爱,所以执着。 模拟考场技能执医中级

查看: 1187|回复: 1

[分享] Stata 计算 患病率比(prevalence ratio)

[复制链接]
epiman 发表于 2018-10-6 23:04:58 | 显示全部楼层 |阅读模式

注册后推荐绑定QQ,之后方才可以使用下方的“用QQ帐号登录”。

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
*** M-H relative risk
5 T0 c- @& }3 P) D$ A
  1. cs ill exposed [fweight = freq], by(confounder)
复制代码
9 a  ~3 {' r( P$ @3 r, n
*** Poisson regression unadjusted! _+ M$ t/ q, u8 _7 d8 h. G
  1. poisson ill exposed confounder [fweight = freq], irr
复制代码
' I8 }5 B9 J5 F
*** Poisson regression adjusted by chi-squared6 ^& [) ]' Q1 L, O: I( w) I; Y
  1. glm ill exposed confounder [fweight = freq], family(poisson) scale(x2) eform
复制代码
. i; T3 `3 n* g4 j' E% }3 z8 l% _4 `
*** Poisson regression adjusted by deviance# G$ t( n' G( T" Q) T3 ^8 f' n* Y
  1. glm ill exposed confounder [fweight = freq], family(poisson) scale(dev) eform irls
复制代码

; f+ F' g2 [# S, z0 k8 R6 H& O*** Poisson regression with robust variance
! j2 J/ r, u- g8 g  V
  1. poisson ill exposed confounder [fweight = freq], irr r
复制代码

/ H' F" f4 J2 C( Z6 J2 c& ~*** Log-binomial regression$ r+ P( e! D8 A' p3 G. c, X$ x5 W! y
  1. glm ill exposed confounder [fweight = freq], family(binomial) link(log) eform
复制代码
# K5 D1 z- d2 t0 p7 v
*** Odds ratio from logistic regression
9 h8 N: d8 c" |% K, j, ?
  1. logistic ill exposed confounder [fweight = freq]
复制代码

& X) I) O6 s% u3 S4 Q
* f6 B$ R9 }* F. tA comparison of two methods for estimating prevalence ratios.
; J1 q+ ^. S9 [. T+ J- Khttps://www.ncbi.nlm.nih.gov/m/p ... m=/14567763/related
: ~2 j9 N* E0 u8 K3 T' {! U" s
( G: h# X- X0 c) u9 h, M4 nPoisson regression with or without robust
* Q' C- W- G8 n# v. Q" E. xhttps://www.statalist.org/forums ... ussion/general/5912
9 }% u! H9 Q) k" I" i: a( P% d5 C+ q7 [. v1 M" P
Poisson Regression with Robust Variance in National Survey Data ( C% F: ~: C1 M
https://www.statalist.org/forums ... ational-survey-data' v3 B, g  H" E+ y
8 p- x, b! x. T1 @9 Z/ |
Alternatives for logistic regression in cross-sectional studies: an empirical comparison of models that directly estimate the prevalence ratio: d  l) W6 D: _. Y! \' b( ]5 Q
https://www.statalist.org/forums/filedata/fetch?id=5927
' g; X$ m1 z. u! ]) R- O, i* Khttps://www.ncbi.nlm.nih.gov/pubmed/14567763) e! G/ l) L8 Q& n5 ]( y* Q

8 U+ {7 o4 s# ]' u( g$ c
 楼主| epiman 发表于 2019-5-5 14:27:55 | 显示全部楼层
Task 1c: How to Generate Age-Adjusted Proportions or Prevalence Rates and Means Using Stata) n% X6 A; E5 ?; K+ E+ q, O
https://www.cdc.gov/nchs/tutoria ... dization/Task1c.htm
6 n5 G, c" i7 n) g' P* q( Z
, _% @3 @. x6 B9 d! |+ f, `" @* W1 @
* ~& [! e& t: W: ZEstimating predicted probabilities from logistic regression: different methods correspond to different target populations( ~. g# H8 h* n- G
https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4052139/4 w- q* o: M1 ~& o5 C' V7 q
4 x0 @5 Z, G8 t* ~
Marginal standardization is the appropriate method when making inference to the overall population.Other methods should be used with caution, and prediction at the means should not be used with binary confounders. Stata, but not SAS, incorporates simple methods for marginal standardization.
5 K. t8 x" D  y4 X0 b6 L5 n5 V4 [$ S
  w4 g: \, {- H% V4 d: u
  1. * Logistic regression adjusting for confounders0 S2 [1 i% U( U/ k+ T2 a
  2. * Outcome is “bmi3” – overweight/obese BMI at wave 3, F: p/ M$ `% x0 O7 U0 |% l
  3. * Exposure is low physical activity (inactive = 1)$ t0 f6 d0 j, y! q$ a: e

  4. 8 H/ h; Z/ H8 z; Y+ j
  5. ** NOTE: Commands given separately for estimating prevalence ratio in v11 **$ a7 Y2 [2 y$ |$ @, Y
  6. ) p+ l6 k0 }  O+ B) a% K
  7. ****************************************************************************
    , q) A3 R; i) y7 }/ e
  8. *** Method 1 – Marginal standardization (standard = TOTAL population)
    & R9 j! }6 y/ j  }9 J$ z

  9. ! T3 }$ }3 a5 O" C* p! V
  10. * First run logistic regression. {5 q& s# C8 A" \! ?/ Y
  11. logit bmi3 i.inactive age18 female white diet bmi2, or
    + f' g4 Z0 ~" K+ ^7 h; ^' I
  12. " K; ~8 c) Q1 G1 i
  13. ** Estimate prevalence difference for inactive = 1 vs. inactive = 0
    * D  k1 k! S/ }$ j, S! V. ]
  14. margins, dydx(inactive)                               
    * A( `6 d' ^$ a+ G0 E' G+ Y  f1 }# b

  15. - a+ g" [5 c' |" }* _
  16. ** Estimate predicted probabilities by exposure level% C! _5 u1 B( k/ ?2 t5 {$ P
  17. margins inactive, post7 z6 e4 ?$ a1 t+ ^: C' P1 }4 H+ a
  18. 7 l; y# w0 P# J  R1 L  f
  19. ** Estimate prevalence ratio for inactive = 1 vs. inactive = 0
    $ u& |$ [- w+ ^& r+ ^: q9 u
  20. ***************************
    ( E5 p+ j# {8 h5 z
  21. *** FOR STATA 12 AND 13 ***
    9 U# l! ]( q& K! x' g) W8 i
  22. margins, coeflegend  b9 H' V+ o9 }0 Z% i4 R. K; h
  23. nlcom (ratio1: _b[1.inactive]/_b[0bn.inactive]), post       
    8 i( b; z( D$ m9 S' k; ?
  24. test ratio1 = 1                                                        3 p6 {' z. e2 Y& q' H8 Y# W
  25.         *** Gives appropriate p value for comparing ratio1 to 1 ; U. P# m1 K0 W3 y9 ]! A' H$ T* o

  26. * g- e; q9 R; z* m1 V2 I% F
  27. * Alternative syntax
    6 W' i' [: Q, J) b0 Q
  28. logit bmi3 i.inactive age18 female white diet bmi2, or
    + O  V$ R) w2 |
  29. margins inactive, post
    / T3 ^+ O# L4 X  p/ b/ J* X; Y
  30. margins, coeflegend
    5 `/ ~& E# P$ D; c) _' T
  31. nlcom (ratio_ln: ln(_b[1.inactive]) - ln(_b[0bn.inactive] )), post
    3 T' A* W) Y) }# a2 z$ Z- D
  32. test ratio_ln
    ( D; s$ F4 d( q1 I+ v/ E2 M5 U
  33.         *** Asymptotically equal to ratio1
    . Y2 V: l5 M& w' {! }# _
  34.         *** NOTE: This syntax will work in Stata v11
    & t9 p3 p3 s" Y) j
  35. . n' }+ g0 Y/ {9 }+ ^" v9 l( m+ t; x
  36. ********************
    5 p4 t+ o6 J( d0 a
  37. *** FOR STATA 11 ***. e* [( h& J1 i4 N" R
  38. logit bmi3 i.inactive age18 female white diet bmi2, or
    + F4 g& j: ]# n, Y1 v+ S% _
  39. margins inactive, post
    ; l( z+ |. r/ l+ h0 N
  40. margins, coeflegend2 i! h6 b+ s  h& b$ d; g/ H, I
  41. nlcom (ratio_v11: _b[1.inactive]/_b[0bn.inactive] - 1), post        / y( I+ m! j8 u. r; q! K
  42. test ratio_v11% S1 U5 B8 F8 ]8 d, ^
  43.         *** Identical to ratio1
    ; w( U- \2 S+ y/ w8 g
  44.         *** Avoids error in Stata v11 by comparing ratio to 0 instead of 1 0 X# c7 K9 C2 ?3 n3 v
  45. ) e: c3 E  f1 {. o& f% n5 S( ^4 I0 B

  46. - t2 |/ R1 h4 |+ n% N3 e
  47. *************************************************************************
    7 F0 h" {. p) @( i& G; s5 O: Q4 \
  48. *** Method 1 – Marginal standardization (standard = EXPOSED population)
    ( l- Q8 O$ R3 K# z6 A- ?

  49. % m7 u3 o! @* @" L/ ~9 U$ }3 X3 n
  50. * First run logistic regression
    * g9 e+ [. G7 O3 M
  51. logit bmi3 i.inactive age18 female white diet bmi2, or % N* }# t4 q' x2 S; l/ |" P* d5 {2 w

  52. : v$ _! C5 f$ j
  53. * Estimate prevalence difference for inactive = 1 vs. inactive = 0
    # v& ]* `, A$ h3 O: \4 T
  54. margins if inactive==1, dydx(inactive)8 Q! s! a5 A7 t, e" I& B2 L& y

  55. 0 o* A0 c2 t4 Q" [3 c
  56. * Estimate predicted probabilities by exposure level: r- ]- V, [" E1 z5 p
  57. margins inactive, subpop(inactive) post
    ; S7 B/ \- b" f9 x
  58.         *** subpop option calculates weights based on inactive = 1 (exposed group)
    6 R, z5 A( j# O

  59. 3 ~) C* g0 O- f: k' Z7 n
  60. ** Estimate prevalence ratio for inactive = 1 vs. inactive = 0
    , O" n/ A% V: N$ Q6 w! ^' `6 W
  61. ***************************
    ) r# H. y2 \+ e0 k3 ~  G9 j
  62. *** FOR STATA 12 AND 13 ***
    3 z6 Z' T4 |+ ^+ ]$ X* t
  63. margins, coeflegend
    / ~; s% H6 v1 z: O1 F
  64. nlcom (ratio1: _b[1.inactive]/_b[0bn.inactive]), post               
    . G4 }; D+ G; B; G. O6 q
  65. test ratio1 = 1                                                               
    5 |3 B! E+ R7 D1 M" h, S/ s

  66. * N0 ?# r, c( I
  67. * Alternative syntax2 w7 S' p, m8 F* O; r
  68. logit bmi3 i.inactive age18 female white diet bmi2, or + c8 o! p* M% y# p
  69. margins inactive, subpop(inactive) post9 s3 l4 Z: a1 v
  70. margins, coeflegend+ x. j: ?3 R3 q, I. F! q- y  I
  71. nlcom (ratio_ln: ln(_b[1.inactive]) - ln(_b[0bn.inactive] )), post
    - }  b1 ~4 n  V& ]8 l
  72. test ratio_ln
    " W, s! z; x% T- a- s, h
  73.         *** Asymptotically equal to ratio1 " c; i6 Y5 r; \
  74.         *** NOTE: This syntax will work in Stata v11
      w7 H' s6 Q# f* U" m! b
  75. 3 \+ A  X& X, c4 T# z
  76. ********************
    4 n. T  B% [. Y- z
  77. *** FOR STATA 11 ***
    ' H1 F; i' P% N4 h
  78. logit bmi3 i.inactive age18 female white diet bmi2, or # w  x  W& ?/ c7 i" C- p$ s9 o  O
  79. margins inactive, subpop(inactive) post
    ) Z' o- e9 B2 P3 J: ~! y
  80. margins, coeflegend
    # A7 c. h* g2 o0 s
  81. nlcom (ratio_v11: _b[1.inactive]/_b[0bn.inactive] - 1), post       
    " y% ~$ [9 D0 j% v* _. n7 k. P
  82. test ratio_v11$ W/ t3 M/ H; E8 S& ?( \
  83.         *** Identical to ratio1
    * k$ U- N' j8 g7 q6 m4 w* c
  84.         *** Avoids error in Stata v11 by comparing ratio to 0 instead of 1
    ( ?% O9 d- }9 h6 O

  85. ; S: b" J3 G' C; i
  86. ******************************************
复制代码
6 b* Y( s2 w# q0 O2 ~% n' [

% N) {* D+ Y. X$ j: P
- Q& K* B- W, }4 F) [
2 _. [8 _* r5 Z/ E
回复

使用道具 举报

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

本版积分规则

提现|充值|至尊会员|接种|公卫人 ( 沪ICP备06060850号-3 )

GMT+8, 2019-8-26 15:53 , Processed in 0.216191 second(s), 29 queries , Gzip On.

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表