楼主: Lisrelchen
2390 10

Tutorials: Tutorial on Count Regression [推广有奖]

  • 0关注
  • 62粉丝

VIP

已卖:4194份资源

院士

67%

还不是VIP/贵宾

-

TA的文库  其他...

Bayesian NewOccidental

Spatial Data Analysis

东西方数据挖掘

威望
0
论坛币
50288 个
通用积分
83.6306
学术水平
253 点
热心指数
300 点
信用等级
208 点
经验
41518 点
帖子
3256
精华
14
在线时间
766 小时
注册时间
2006-5-4
最后登录
2022-11-6

楼主
Lisrelchen 发表于 2016-5-29 04:04:07 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币

Atkins, D. C., Baldwin, S., Zheng, C., Gallop, R. J., & Neighbors, C. (in press). A tutorial on count regression and zero-altered count models for longitudinal addictions data.




二维码

扫码加我 拉你入群

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

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

关键词:regression Tutorials regressio Tutorial regress count

本帖被以下文库推荐

沙发
Lisrelchen 发表于 2016-5-29 04:05:36

Count Regression using SPSS

  1. GENLINMIXED
  2. /DATA_STRUCTURE SUBJECTS=id
  3. /FIELDS TARGET=rapi
  4. /TARGET_OPTIONS DISTRIBUTION=POISSON LINK=LOG
  5. /FIXED EFFECTS=gender time gender*time
  6. /RANDOM EFFECTS=time USE_INTERCEPT=TRUE SUBJECTS=id
  7. COVARIANCE_TYPE=UNSTRUCTURED .
  8. GENLINMIXED
  9. /DATA_STRUCTURE SUBJECTS=id
  10. /FIELDS TARGET=rapi
  11. /TARGET_OPTIONS DISTRIBUTION=NEGATIVE_BINOMIAL LINK=LOG
  12. /FIXED EFFECTS=gender time gender*time
  13. /RANDOM USE_INTERCEPT=TRUE SUBJECTS=id COVARIANCE_TYPE=UNSTRUCTURED .
复制代码

藤椅
Lisrelchen 发表于 2016-5-29 04:09:22

Count Regression using Mplus

  1. Title:
  2.     GLMM NB RAPI Hurdle

  3. Data:
  4.     File IS RAPI.final.csv;

  5. Variable:
  6.     Names ARE id rapi male time;
  7.     Usevariables ARE id rapi male time;
  8.     Cluster IS id;
  9.     Count IS rapi (nbh);
  10.     Within IS time;
  11.     Between IS male;

  12. Analysis:
  13.     Type = twolevel random;
  14.     Processors = 4;
  15.     Integration = MONTECARLO;
  16.     Estimator = MLR;

  17. Model:
  18.    
  19.     %WITHIN%
  20.     tslope | rapi ON time;         !fixed effect for time;
  21.                                                         !tslope is the random effect for time;
  22.     tslopei | rapi#1 ON time;        !fixed effect for time -- zeros;
  23.                                                                 !tslope is the random effect for time -- zeros;
  24.    
  25.     %BETWEEN%
  26.     rapi;                                         !random intercept;
  27.     rapi#1;                                        !random intercept -- zeros;
  28.     tslope rapi ON male;         !fixed effect for male and male x time;
  29.     tslopei rapi#1 ON male;        !fixed effect for male and male x time -- zeros;
  30.     tslope WITH rapi;                 !covariance between random effects;
  31.     tslopei WITH rapi#1;        !covariance between random effects -- zeros;

  32.    
  33.    
复制代码

板凳
Lisrelchen 发表于 2016-5-29 04:10:16

Count Regression using Mplus

  1. Title:
  2.     GLMM Poisson RAPI Model 1

  3. Data:
  4.     File IS RAPI.final.csv;

  5. Variable:
  6.     Names ARE id rapi male time;
  7.     Usevariables ARE id rapi male time;
  8.     Cluster IS id;
  9.     Count IS rapi;
  10.     Within IS time;
  11.     Between IS male;

  12. Analysis:
  13.     Type = twolevel random;
  14.     Processors = 4;
  15.     Estimator = MLR;

  16. Model:
  17.    
  18.     %WITHIN%
  19.     tslope | rapi ON time;         !fixed effect for time;
  20.                                                     !tslope is the random effect for time;
  21.     %BETWEEN%
  22.     rapi;                                         !random intercept;
  23.     tslope;                                 !random slope;
  24.     rapi ON male;                         !fixed effect for male;
  25.     tslope WITH rapi;                 !covariance between random effects;
复制代码

报纸
Lisrelchen 发表于 2016-5-29 04:11:51

Count Regression using Mplus

  1. Title:
  2.     GLMM Poisson RAPI Model 2

  3. Data:
  4.     File IS RAPI.final.csv;

  5. Variable:
  6.     Names ARE id rapi male time;
  7.     Usevariables ARE id rapi male time;
  8.     Cluster IS id;
  9.     Count IS rapi;
  10.     Within IS time;
  11.     Between IS male;

  12. Analysis:
  13.     Type = twolevel random;
  14.     Processors = 4;
  15.     Estimator = MLR;

  16. Model:
  17.    
  18.     %WITHIN%
  19.     tslope | rapi ON time;         !fixed effect for time;
  20.                                                     !tslope is the random effect for time;
  21.     %BETWEEN%
  22.     rapi;                                         !random intercept;
  23.     tslope rapi ON male;         !fixed effect for male and male by time interaction;
  24.     tslope WITH rapi;                 !covariance between random effects;

  25.    
  26.    
复制代码

地板
Lisrelchen 发表于 2016-5-29 04:13:14

Count Regression using Mplus

  1. Title:
  2.     NB TLFB Hurdle;

  3. Data:
  4.     File IS TLFB.final.csv;

  5. Variable:
  6.     Names ARE id day drinks male weekend greek;
  7.     Usevariables ARE id drinks male weekend greek mgreek;
  8.     Cluster IS id;
  9.     Count IS drinks (nbh);
  10.     Within IS weekend;
  11.     Between IS male greek mgreek;

  12. Define:
  13.         mgreek = male*greek;

  14. Analysis:
  15.     Type = twolevel random;
  16.     Processors = 4;
  17.     Integration = MONTECARLO;
  18.     Estimator = MLR;

  19. Model:

  20.    
  21.         %WITHIN%
  22.         wslope | drinks ON weekend; !fixed effect for weekend;
  23.                                     !wslope is the random slope for time;
  24.         wslopei | drinks#1 ON weekend; !fixed effect for weekend - zeros;
  25.                                        !wslope is the random slope for time - zeros;
  26.         %BETWEEN%
  27.         drinks; !random intercept;
  28.         drinks#1; !random intercept -- zeros;
  29.         wslope drinks ON male greek; !fixed effect for male, greek, ;
  30.                                          !male x weekend and greek x weekend;
  31.         drinks ON mgreek;            ! fixed effect for male x greek interaction;
  32.         wslopei drinks#1 ON male greek; !fixed effect for male, greek, -- zeros ;
  33.                                         !male x weekend and greek x weekend -- zeros;
  34.         drinks#1 ON mgreek;             ! fixed effect for male x greek interaction -- zeros;
  35.         wslope WITH drinks;                                ! covariance between random effects;
  36.         wslopei WITH drinks#1;                        ! covariance between random effects -- zeros;
  37.         
复制代码

7
Lisrelchen 发表于 2016-5-29 04:14:17

Count Regression using Mplus

  1. Title:
  2.     NB TLFB;

  3. Data:
  4.     File IS TLFB.final.csv;

  5. Variable:
  6.     Names ARE id day drinks male weekend greek;
  7.     Usevariables ARE id drinks male weekend greek mgreek;
  8.     Cluster IS id;
  9.     Count IS drinks (nb);
  10.     Within IS weekend;
  11.     Between IS male greek mgreek;

  12. Define:
  13.         mgreek = male*greek;

  14. Analysis:
  15.     Type = twolevel random;
  16.     Processors = 4;
  17.     Estimator = MLR;

  18. Model:
  19.    
  20.         %WITHIN%
  21.         wslope | drinks ON weekend; !fixed effect for weekend;
  22.                                                                 !wslope is the random slope for time;
  23.         %BETWEEN%
  24.         drinks;                                                !random intercept
  25.         wslope drinks ON male greek; !fixed effect for male, greek, ;
  26.                                                                  !male x weekend and greek x weekend;
  27.         drinks ON mgreek;                         ! fixed effect for male x greek interaction;
  28.         wslope WITH drinks;                        ! covariance between random effects;
  29.         
  30.         
复制代码

8
Lisrelchen 发表于 2016-5-29 04:16:06

Count Regression using Stata

  1. **************************************************************
  2. ** Analyses of RAPI data for count regression tutorial *******
  3. ** IR, 5/8/12                                                                                         ******
  4. **************************************************************

  5. /* read in file */
  6. insheet using "http://depts.washington.edu/cshrb/newweb/stats%20documents/RAPI.Final.csv"

  7. ************************************************************
  8. /* Poisson mixed effects model with random intercept only */
  9. ************************************************************
  10. xi: xtmepoisson rapi i.gender*time || id:,

  11. /* store model estimates for comparison to other models */
  12. estimates store model0

  13. **************************************************************************
  14. /* Poisson mixed effects model with random effects for intercept + time */
  15. **************************************************************************

  16. xi: xtmepoisson rapi i.gender*time || id: time,
  17. estimates store model1



  18. ****************************
  19. /* over-dispersed Poisson */
  20. ****************************

  21. /* create variable for over-dispersion term */
  22. gen obs = _n

  23. xi: xtmepoisson rapi i.gender*time || id: || obs:,
  24. estimates store model2

  25. ********************************************************
  26. /* over-dispersed Poisson with random effect for time */
  27. ********************************************************

  28. xi: xtmepoisson rapi i.gender*time || id: time || obs:,
  29. estimates store model3

  30. ************************************************************************************
  31. /* LR test comparing overdispersed models with and without random effect for time */
  32. ************************************************************************************

  33. lrtest model2 model3

  34. **********************************************************************
  35. /* LR test comparing non-overdispersed model to overdispersed model */
  36. /* with random effects of intercept and time*/
  37. *********************************************************************

  38. lrtest model1 model3



  39. ****************************************
  40. /* Random intercept negative binomial */
  41. ****************************************
  42. xi: xtnbreg rapi i.gender*time, i(id) re /* re is random effects estimator which is already the default */

  43. xi: xtnbreg rapi i.gender*time, i(id) irr  /* show rate ratios */

  44. **********************************************
  45. /* random intercept Poisson using xtpoisson */
  46. **********************************************
  47. xtset id time

  48. xi: xtpoisson rapi i.gender*time, re
  49. xi: xtpoisson rapi i.gender*time, i(id) normal

  50. ******************
  51. /* GEE Poisson */
  52. *****************
  53. xtset id time

  54. xi: xtgee rapi i.gender*time, family(poisson) corr(exchangeable)

  55. ***************************
  56. /* GEE negative binomial */
  57. ***************************

  58. xi: xtgee rapi i.gender*time, family(nbinomial) corr(exchangeable)
复制代码

9
dingyuezhang 发表于 2016-5-29 08:08:42
谢谢分享!

10
shgby 发表于 2016-5-29 08:14:46
tutorial on count regression and zero-altered count models for longitudinal addictions data.谢谢分享!

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

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2026-1-2 22:41