Multivariate Generalised Linear Mixed Models Via Sabrer (Sabre in R)
Total Page:16
File Type:pdf, Size:1020Kb
Multivariate Generalised Linear Mixed Models via sabreR (Sabre in R) Rob Crouchley Dave Stott [email protected] [email protected] Centre for e-Science Centre for e-Science Lancaster University Lancaster University John Pritchard Dan Grose [email protected] [email protected] Centre for e-Science Centre for e-Science Lancaster University Lancaster University version 1 ii Contents Preface xv Acknowledgements xix 1LinearModelsI 1 1.1 Random EffectsANOVA....................... 1 1.2 The Intraclass Correlation Coefficient............... 2 1.3ParameterEstimationbyMaximumLikelihood.......... 3 1.4 Regression with level-2 effects.................... 5 1.5 Example C1. Linear Model of Pupil’s Maths Achievement . 5 1.5.1 Reference........................... 6 1.5.2 Data description for hsb.tab ................ 6 1.5.3 Variables........................... 6 1.6 Including School-Level Effects-Model2.............. 8 1.6.1 Sabrecommands....................... 8 1.6.2 Sabre log file......................... 9 1.6.3 Model1discussion...................... 11 1.6.4 Model2discussion...................... 11 1.7Exercises............................... 12 iii iv CONTENTS 1.8References............................... 12 2LinearModelsII 13 2.1Introduction.............................. 13 2.2Two-LevelRandomInterceptModels................ 13 2.3 General Two-Level Models Including Random Intercepts . 15 2.4Likelihood:general2-levelmodels................. 15 2.5Residuals............................... 16 2.6CheckingAssumptionsinMultilevelModels............ 17 2.7 Example C2. Linear model of Pupil’s Maths Achievement . 18 2.7.1 References........................... 18 2.7.2 Data description for hsb.tab ................ 18 2.7.3 Variables........................... 18 2.7.4 Sabrecommands....................... 19 2.7.5 Sabre log file......................... 20 2.7.6 Discussion........................... 21 2.8ComparingModelLikelihoods.................... 22 2.9Exercises:two-levellinearmodel.................. 23 2.10LinearGrowthModels........................ 23 2.10.1ATwoLevelRepeatedMeasuresModel.......... 23 2.11Likelihood:2-levelgrowthmodels.................. 24 2.12ExampleL3.Lineargrowthmodel................. 25 2.12.1Reference........................... 25 2.12.2Datadescriptionforgrowth.tab............... 25 2.12.3Variables........................... 25 2.12.4Sabrecommands....................... 27 CONTENTS v 2.12.5 Sabre log file:......................... 28 2.12.6Discussion........................... 29 2.13Exercise:lineargrowthmodel.................... 29 2.14References............................... 29 3 Multilevel Binary Response Models 31 3.1Introduction.............................. 31 3.2TheTwo-LevelLogisticModel................... 32 3.3LogitandProbitTransformations.................. 33 3.4GeneralTwo-LevelLogisticModels................. 34 3.5 Residual Intraclass Correlation Coefficient............. 34 3.6Likelihood............................... 34 3.7 Example C3. Binary Response Model of Pupil’s Repeating a GradeatPrimarySchool...................... 36 3.7.1 References........................... 36 3.7.2 Data description for thaieduc1.tab ............ 36 3.7.3 Variables........................... 36 3.7.4 Sabrecommands....................... 38 3.7.5 Sabre log file......................... 38 3.7.6 Discussion........................... 40 3.8Exercises............................... 41 3.9References............................... 41 4 Multilevel Models for Ordered Categorical Variables 43 4.1Introduction.............................. 43 4.2TheTwo-LevelOrderedLogitModel................ 44 4.3Level-1Model............................. 45 vi CONTENTS 4.4Level-2Model............................. 46 4.5DichotomizationofOrderedCategories............... 46 4.6Likelihood............................... 47 4.7 Example C4. Ordered Response Model of Teacher’s Commitment toTeaching.............................. 48 4.7.1 Reference........................... 48 4.7.2 Data description for teacher1.tab and teacher2.tab .. 48 4.7.3 Variables........................... 48 4.7.4 Sabrecommands....................... 50 4.7.5 Sabre log file......................... 51 4.7.6 Discussion........................... 51 4.8Exercises............................... 53 4.9References............................... 53 5 Multilevel Poisson Models 55 5.1Introduction.............................. 55 5.2PoissonRegressionModels...................... 56 5.3TheTwo-LevelPoissonModel.................... 56 5.4Level-1Model............................. 57 5.5Level-2Model:TheRandomInterceptModel........... 57 5.6Likelihood............................... 58 5.7ExampleC5.PoissonModelofPrescribedMedications...... 59 5.7.1 References........................... 59 5.7.2 Data description for racd.tab ............... 59 5.7.3 Variables........................... 59 5.7.4 Sabrecommands....................... 60 CONTENTS vii 5.7.5 Sabre log file......................... 61 5.7.6 Discussion........................... 62 5.8Exercises............................... 63 5.9References............................... 63 6 Two-Level Generalised Linear Mixed Models 65 6.1Introduction.............................. 65 6.2TheLinearModel.......................... 66 6.3BinaryResponseModels....................... 67 6.4PoissonModel............................ 68 6.5Two-LevelGeneralisedLinearModelLikelihood.......... 68 6.6References............................... 69 7 Three-Level Generalised Linear Mixed Models 71 7.1Introduction.............................. 71 7.2Three-LevelRandomInterceptModels............... 71 7.3 Three-LevelGLM.......................... 72 7.4Linearmodel............................. 72 7.5BinaryResponseModel....................... 73 7.6Three-LevelGeneralisedLinearModelLikelihood......... 74 7.7 Example 3LC2. Binary response model: Guatemalan mothers using prenatal care for their children (1558 mothers in 161 com- munities)............................... 75 7.7.1 References........................... 75 7.7.2 Data description for guatemala_prenat.tab ....... 75 7.7.3 Variables........................... 75 7.7.4 Sabrecommands....................... 77 viii CONTENTS 7.7.5 Sabre log file......................... 77 7.7.6 Discussion........................... 78 7.8Exercises............................... 80 7.9References............................... 80 8 Multivariate Two-Level Generalised Linear Mixed Models 81 8.1Introduction.............................. 81 8.2 Multivariate 2-Level Generalised Linear Mixed Model Likelihood 82 8.3 Example C6. Bivariate Poisson Model: Number of Visits to the DoctorandNumberofPrescriptions................ 83 8.3.1 References........................... 83 8.3.2 Data description for visit-prescribe.tab ........ 83 8.3.3 Variables........................... 84 8.3.4 Sabrecommands....................... 85 8.3.5 Sabre log file......................... 86 8.3.6 Discussion........................... 88 8.4 Example L9. Bivariate Linear and Probit Model: Wage and TradeUnionMembership...................... 90 8.4.1 References........................... 91 8.4.2 Data description for nls.tab ................ 91 8.4.3 Variables........................... 91 8.4.4 Sabrecommands....................... 92 8.4.5 Sabre log file......................... 93 8.4.6 Discussion........................... 96 8.5Exercises............................... 97 8.6References............................... 97 CONTENTS ix 9EventHistoryModels 99 9.1Introduction.............................. 99 9.2DurationModels...........................101 9.3Two-levelDurationModels.....................102 9.4Renewalmodels............................103 9.5ExampleL7.RenewalModelofResidentialMobility.......105 9.5.1 Data description for roch.tab ...............105 9.5.2 Variables...........................105 9.5.3 Sabrecommands.......................106 9.5.4 Sabre log file.........................107 9.5.5 Discussion...........................109 9.5.6 Exercise............................110 9.6Three-levelDurationModels....................110 9.6.1 Exercises...........................110 9.7CompetingRiskModels.......................110 9.8Likelihood...............................113 9.9 Example L8. Correlated Competing Risk Model of Filled and LapsedVacancies...........................114 9.9.1 References...........................114 9.9.2 Data description for vacancies.tab ............114 9.9.3 Variables...........................114 9.9.4 Sabrecommands.......................115 9.9.5 Sabre log file.........................116 9.9.6 Discussion...........................118 9.9.7 Exercises...........................119 9.10References...............................119 xCONTENTS 10 Stayers, Non-susceptibles and Endpoints 121 10.1Introduction..............................121 10.2LikelihoodwithEndpoints......................124 10.3End-points:PoissonExample....................125 10.3.1PoissonData.........................125 10.3.2 Data description for rochmigx.tab .............125 10.3.3Variables...........................126 10.3.4Sabrecommands.......................127 10.3.5 Sabre log file.........................127 10.3.6Discussion...........................128 10.4End-points:BinaryResponseExample...............129 10.4.1 Data description for rochmig.tab .............129 10.4.2Variables...........................129 10.4.3Sabrecommands.......................130 10.4.4 Sabre log file.........................131 10.4.5Discussion...........................132 10.5Exercises...............................134