Interpreting and visualizing regression models using stata

695 87 0
Interpreting and visualizing regression models using stata

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

đ Copyright â 2012, 2021 by StataCorp LLC All rights reserved First edition 2012 Second edition 2021 Published by Stata Press, 4905 Lakeway Drive, College Station, Texas 77845 Typeset in LATEX Printed in the United States of America 10 Print ISBN-10: 1-59718-321-0 Print ISBN-13: 978-1-59718-321-5 ePub ISBN-10: 1-59718-322-9 ePub ISBN-13: 978-1-59718-322-2 Mobi ISBN-10: 1-59718-323-7 Mobi ISBN-13: 978-1-59718-323-9 Library of Congress Control Number: 2020950108 No part of this book may be reproduced, stored in a retrieval system, or transcribed, in any form or by any means—electronic, mechanical, photocopy, recording, or otherwise—without the prior written permission of StataCorp LLC Stata, , Stata Press, Mata, StataCorp LLC , and NetCourse are registered trademarks of Stata and Stata Press are registered trademarks with the World Intellectual Property Organization of the United Nations NetCourseNow is a trademark of StataCorp LLC LATEX is a trademark of the American Mathematical Society Contents Tables Figures Preface to the Second Edition Preface to the First Edition Acknowledgments Introduction 1.1 Read me first 1.2 The GSS dataset 1.2.1 Income 1.2.2 Age 1.2.3 Education 1.2.4 Gender 1.3 The pain datasets 1.4 The optimism datasets 1.5 The school datasets 1.6 The sleep datasets 1.7 Overview of the book I Continuous predictors Continuous predictors: Linear 2.1 Chapter overview 2.2 Simple linear regression 2.2.1 Computing predicted means using the margins command 2.2.2 Graphing predicted means using the marginsplot command 2.3 Multiple regression 2.3.1 Computing adjusted means using the margins command 2.3.2 Some technical details about adjusted means 2.3.3 Graphing adjusted means using the marginsplot command 2.4 Checking for nonlinearity graphically 2.4.1 Using scatterplots to check for nonlinearity 2.4.2 Checking for nonlinearity using residuals 2.4.3 Checking for nonlinearity using locally weighted smoother 2.4.4 Graphing outcome mean at each level of predictor 2.4.5 Summary 2.5 Checking for nonlinearity analytically 2.5.1 Adding power terms 2.5.2 Using factor variables 2.6 Summary Continuous predictors: Polynomials 3.1 Chapter overview 3.2 Quadratic (squared) terms 3.2.1 Overview 3.2.2 Examples Interpreting the relationship between age and income Graphing adjusted means with confidence intervals 3.3 Cubic (third power) terms 3.3.1 Overview 3.3.2 Examples 3.4 Fractional polynomial regression 3.4.1 Overview 3.4.2 Example using fractional polynomial regression 3.5 Main effects with polynomial terms 3.6 Summary Continuous predictors: Piecewise models 4.1 Chapter overview 4.2 Introduction to piecewise regression models 4.3 Piecewise with one known knot 4.3.1 Overview 4.3.2 Examples using the GSS Individual slope coding Change in slope coding Summary 4.4 Piecewise with two known knots 4.4.1 Overview 4.4.2 Examples using the GSS 4.5 Piecewise with one knot and one jump 4.5.1 Overview 4.5.2 Examples using the GSS 4.6 Piecewise with two knots and two jumps 4.6.1 Overview 4.6.2 Examples using the GSS 4.7 Piecewise with an unknown knot 4.8 Piecewise model with multiple unknown knots 4.9 Piecewise models and the marginsplot command 4.10 Automating graphs of piecewise models 4.11 Summary Continuous by continuous interactions 5.1 Chapter overview 5.2 Linear by linear interactions 5.2.1 Overview 5.2.2 Example using GSS data 5.2.3 Interpreting the interaction in terms of age 5.2.4 Interpreting the interaction in terms of education 5.2.5 Interpreting the interaction in terms of age slope 5.2.6 Interpreting the interaction in terms of the educ slope 5.3 Linear by quadratic interactions 5.3.1 Overview 5.3.2 Example using GSS data 5.4 Summary Continuous by continuous by continuous interactions 6.1 Chapter overview 6.2 Overview 6.3 Examples using the GSS data 6.3.1 A model without a three-way interaction 6.3.2 A three-way interaction model Visualizing the three-way interaction Visualizing the age slope 6.4 Summary II Categorical predictors Categorical predictors 7.1 Chapter overview 7.2 Comparing two groups using a t test 7.3 More groups and more predictors 7.4 Overview of contrast operators 7.5 Compare each group against a reference group 7.5.1 Selecting a specific contrast 7.5.2 Selecting a different reference group 7.5.3 Selecting a contrast and reference group 7.6 Compare each group against the grand mean 7.6.1 Selecting a specific contrast 7.7 Compare adjacent means 7.7.1 Reverse adjacent contrasts 7.7.2 Selecting a specific contrast 7.8 Comparing the mean of subsequent or previous levels 7.8.1 Comparing the mean of previous levels 7.8.2 Selecting a specific contrast 7.9 Polynomial contrasts 7.10 Custom contrasts 7.11 Weighted contrasts 7.12 Pairwise comparisons 7.13 Interpreting confidence intervals 7.14 Testing categorical variables using regression 7.15 Summary Categorical by categorical interactions 8.1 Chapter overview 8.2 Two by two models: Example 8.2.1 Simple effects 8.2.2 Estimating the size of the interaction 8.2.3 More about interaction 8.2.4 Summary 8.3 Two by three models 8.3.1 Example Simple effects Partial interactions 8.3.2 Example Simple effects Simple contrasts Partial interaction 8.3.3 Summary 8.4 Three by three models: Example 8.4.1 Simple effects 8.4.2 Simple contrasts 8.4.3 Partial interaction 8.4.4 Interaction contrasts 8.4.5 Summary 8.5 Unbalanced designs 8.6 Main effects with interactions: anova versus regress 8.7 Interpreting confidence intervals 8.8 Summary Categorical by categorical by categorical interactions 9.1 Chapter overview 9.2 Two by two by two models 9.2.1 Simple interactions by season 9.2.2 Simple interactions by depression status 9.2.3 Simple effects 9.3 Two by two by three models 9.3.1 Simple interactions by depression status 9.3.2 Simple partial interaction by depression status 9.3.3 Simple contrasts 9.3.4 Partial interactions 9.4 Three by three by three models and beyond 9.4.1 Partial interactions and interaction contrasts 9.4.2 Simple interactions 9.4.3 Simple effects and simple comparisons 9.5 Summary III Continuous and categorical predictors 10 Linear by categorical interactions 10.1 Chapter overview 10.2 Linear and two-level categorical: No interaction 10.2.1 Overview 10.2.2 Examples using the GSS Adjusted means Unadjusted means Summary 10.3 Linear by two-level categorical interactions 10.3.1 Overview 10.3.2 Examples using the GSS Estimates of slopes Estimates and contrasts on means 10.4 Linear by three-level categorical interactions 10.4.1 Overview 10.4.2 Examples using the GSS Estimates and contrasts on slopes Estimates and contrasts on means 10.5 Summary 11 Polynomial by categorical interactions 11.1 Chapter overview 11.2 Quadratic by categorical interactions 11.2.1 Overview 11.2.2 Quadratic by two-level categorical 11.2.3 Quadratic by three-level categorical 11.3 Cubic by categorical interactions 11.4 Summary 12 Piecewise by categorical interactions 12.1 Chapter overview 12.2 One knot and one jump 12.2.1 Comparing slopes across gender 12.2.2 Comparing slopes across education 12.2.3 Difference in differences of slopes 12.2.4 Comparing changes in intercepts 12.2.5 Computing and comparing adjusted means 12.2.6 Graphing adjusted means 12.3 Two knots and two jumps 12.3.1 Comparing slopes across gender 12.3.2 Comparing slopes across education 12.3.3 Difference in differences of slopes 12.3.4 Comparing changes in intercepts by gender 12.3.5 Comparing changes in intercepts by education 12.3.6 Computing and comparing adjusted means 12.3.7 Graphing adjusted means 12.4 Comparing coding schemes 12.4.1 Coding scheme #1 12.4.2 Coding scheme #2 12.4.3 Coding scheme #3 12.4.4 Coding scheme #4 12.4.5 Choosing coding schemes 12.5 Summary 13 Continuous by continuous by categorical interactions 13.1 Chapter overview 13.2 Linear by linear by categorical interactions 13.2.1 Fitting separate models for males and females 13.2.2 Fitting a combined model for males and females 13.2.3 Interpreting the interaction focusing in the age slope 13.2.4 Interpreting the interaction focusing on the educ slope 13.2.5 Estimating and comparing adjusted means by gender 13.3 Linear by quadratic by categorical interactions 13.3.1 Fitting separate models for males and females 13.3.2 Fitting a common model for males and females 13.3.3 Interpreting the interaction 13.3.4 Estimating and comparing adjusted means by gender 13.4 Summary 14 Continuous by categorical by categorical interactions 14.1 Chapter overview 14.2 Simple effects of gender on the age slope 14.3 Simple effects of education on the age slope 14.4 Simple contrasts on education for the age slope 14.5 Partial interaction on education for the age slope 14.6 Summary IV Beyond ordinary linear regression 15 Multilevel models 15.1 Chapter overview 15.2 Example 1: Continuous by continuous interaction 15.3 Example 2: Continuous by categorical interaction 15.4 Example 3: Categorical by continuous interaction 15.5 Example 4: Categorical by categorical interaction 15.6 Summary 16 Time as a continuous predictor 16.1 Chapter overview 16.2 Example 1: Linear effect of time 16.3 Example 2: Linear effect of time by a categorical predictor 16.4 Example 3: Piecewise modeling of time 16.5 Example 4: Piecewise effects of time by a categorical predictor 16.5.1 Baseline slopes 16.5.2 Change in slopes: Treatment versus baseline 16.5.3 Jump at treatment 16.5.4 Comparisons among groups 16.6 Summary 17 Time as a categorical predictor 17.1 Chapter overview 17.2 Example 1: Time treated as a categorical variable 17.3 Example 2: Time (categorical) by two groups 17.4 Example 3: Time (categorical) by three groups 17.5 Comparing models with different residual covariance structures 17.6 Analyses with small samples 17.7 Summary 18 Nonlinear models 18.1 Chapter overview 18.2 Binary logistic regression 18.2.1 A logistic model with one categorical predictor Using the contrast command Using the pwcompare command Using the margins and marginsplot commands Using the margins command with the pwcompare option 18.2.2 A logistic model with one continuous predictor 18.2.3 A logistic model with covariates 18.3 Multinomial logistic regression 18.4 Ordinal logistic regression 18.5 Poisson regression 18.6 More applications of nonlinear models 18.6.1 Categorical by categorical interaction 18.6.2 Categorical by continuous interaction 18.6.3 Piecewise modeling 18.7 Summary 19 Complex survey data V Appendices A Customizing output from estimation commands A.1 Omission of output A.2 Specifying the confidence level A.3 Customizing the formatting of columns in the coefficient table A.4 Customizing the display of factor variables B The margins command B.1 The predict() and expression() options B.2 The at() option B.3 Margins with factor variables B.4 Margins with factor variables and the at() option B.5 The dydx() and related options B.6 Specifying the confidence level B.7 Customizing column formatting C The marginsplot command D The contrast command D.1 Inclusion and omission of output D.2 Customizing the display of factor variables D.3 Adjustments for multiple comparisons D.4 Specifying the confidence level D.5 Customizing column formatting E The pwcompare command References Author index Subject index customizing the legend, C display of confidence interval, C , C , C display of fit line, C , C fcolor() option, C , C labeling the by-dimension, C labeling the plot dimension, C , C labeling the x dimension, C lcolor() option, C , C legend() option, C line thickness, C marker size, C marker symbol, C noci option, C omitting confidence interval, C plotdimension() option, C , C plotopts() option, C recast() option, C , C recast(line) option, C recastci() option, C , C recastci() option, C scheme() option, C scheme() option, C selecting a scheme, C selecting dimension for axis, C selecting the by-dimension, C selecting the plot dimension, C subtitle() option, C title() option, C xdimension() option, C xlabel() option, C xscale() option, C xtitle() option, C ylabel() option, C yscale() option, C ytitle() option, C mixed command residuals() option, 17.2 , 17.2 , 17.5 , 17.5 mixed model, see multilevel model mkspline command, 4.3.2 , 4.3.2 marginal option, 4.3.2 , 4.3.2 mlogit command, 18.3 , 18.3 multilevel model, 15.1 , 15.6 cross-level interactions, see cross-level interactions longitudinal, see time, modeled continuously multinomial logistic regression, 18.3 , 18.3 contrast command, 18.3 , 18.3 margins command, 18.3 , 18.3 marginsplot command, 18.3 , 18.3 pwcompare command, 18.3 , 18.3 multiple comparison adjustments, B.3 , B.3 , D.3 , D.3 , E , E multiple regression, 2.3 , 2.3.3 N nested model, see multilevel model nonlinear models, 18 , 18.7 categorical by categorical interactions, 18.6.1 , 18.6.1 continuous by categorical interactions, 18.6.2 , 18.6.2 piecewise models, 18.6.3 , 18.6.3 nonlinear relationships cubic predictor, 3.3.1 , 3.3.2 fractional polynomial, 3.4 , 3.4.2 piecewise models, 4.1 , 4.11 polynomial predictor, 3.1 , 3.6 quadratic predictor, 3.2 , 3.2.2 O command, 18.4 , 18.4 ordinal logistic regression, 18.4 , 18.4 contrast command, 18.4 , 18.4 margins command, 18.4 , 18.4 marginsplot command, 18.4 , 18.4 ologit P pairwise comparisons, 7.12 , 7.12 partial interactions three by three by three design, 9.4.1 , 9.4.1 three by three design, 8.4.3 , 8.4.3 two by three design, 8.3.1 , 8.3.1 , 8.3.2 , 8.3.2 two by two by three design, 9.3.4 , 9.3.4 piecewise by categorical interactions, 12 , 12.5 comparing coding schemes, 12.4 , 12.4.5 one knot and one jump, 12.2 , 12.2.6 overview of, 12.1 , 12.1 two knots and two jumps, 12.3 , 12.3.7 piecewise models, 4.1 , 4.11 automating graphs, 4.10 , 4.10 change in slope coding, 4.3.2 , 4.3.2 individual slope coding, 4.3.2 , 4.3.2 logistic regression, 18.6.3 , 18.6.3 multiple unknown knots, 4.8 , 4.8 one knot, 4.3 , 4.3.2 one knot and one jump, 4.5 , 4.5.2 one unknown knot, 4.7 , 4.7 piecewise by categorical interactions, see piecewise by categorical interactions two knots, 4.4 , 4.4.2 two knots and two jumps, 4.6 , 4.6.2 poisson command, 18.5 , 18.5 Poisson regression, 18.5 , 18.5 contrast command, 18.5 , 18.5 margins command, 18.5 , 18.5 marginsplot command, 18.5 , 18.5 pwcompare command, 18.5 , 18.5 polynomial contrasts, 7.9 , 7.9 polynomial models interpreting main effects, 3.5 , 3.5 polynomial predictor, 3.1 , 3.6 predicted means, computing, 2.2.2 , 2.2.2 predictive margins, 18.2.1 , 18.2.1 previous levels, contrast to, 7.8.1 , 7.8.2 pwcompare command, 7.12 , 7.12 , E , E cimargins option, E , E groups option, E , E mcompare() option, E , E pveffects option, E , E Šidák adjustment, 7.12 , 7.12 sort option, E , E Q quadratic by categorical interactions, 11.2 , 11.2.3 quadratic by linear by categorical interactions, see linear by quadratic by categorical interactions quadratic by linear interactions, see continuous by continuous interactions quadratic predictor, 3.2 , 3.2.2 graphing, 3.2.2 , 3.2.2 interpretation of, 3.2.1 , 3.2.1 , 3.2.2 , 3.2.2 quadratic term interpretation of, 3.2.1 , 3.2.1 , 3.2.2 , 3.2.2 R random-coefficient model, see multilevel model reference group contrasts, 7.5 , 7.5.3 versus anova command, 7.14 , 7.14 , 8.6 , 8.6 repeated-measures models, see time, modeled categorically residual covariance structures, comparing, 17.5 , 17.5 regress S Scheffé adjustments, B.3 , B.3 , D.3 , D.3 , E , E selecting contrasts, 7.5.1 , 7.5.1 , 7.5.3 , 7.5.3 , 7.6.1 , 7.6.1 , 7.7.2 , 7.7.2 , 7.8.2 , 7.8.2 selecting reference group, 7.5.2 , 7.5.2 , 7.5.3 , 7.5.3 Šidák adjustments, B.3 , B.3 , D.3 , D.3 , E , E simple comparisons three by three by three design, 9.4.3 , 9.4.3 simple contrasts three by three design, 8.4.2 , 8.4.2 two by three design, 8.3.2 , 8.3.2 two by two by three design, 9.3.3 , 9.3.3 simple effects three by three by three design, 9.4.3 , 9.4.3 three by three design, 8.4.1 , 8.4.1 two by three design, 8.3.1 , 8.3.1 , 8.3.2 , 8.3.2 two by two by two design, 9.2.3 , 9.2.3 two by two design, 8.2.1 , 8.2.3 simple interactions three by three by three design, 9.4.2 , 9.4.2 two by two by three design, 9.3.1 , 9.3.1 two by two by two design, 9.2.1 , 9.2.2 simple linear regression, 2.2 , 2.2.2 simple partial interactions two by two by three design, 9.3.2 , 9.3.2 spline regression, see piecewise models split plot design, 17.3 , 17.4 squared term interpretation of, 3.2.1 , 3.2.1 , 3.2.2 , 3.2.2 Student–Newman–Keuls adjustments, E , E subsequent levels, contrast to, 7.8 , 7.8.2 survey data, see complex survey data svy prefix, 19 , 19 svyset command, 19 , 19 T test, 7.2 , 7.2 three by three by three design, 9.4 , 9.4.3 interaction contrasts, 9.4.1 , 9.4.1 partial interactions, 9.4.1 , 9.4.1 simple comparisons, 9.4.3 , 9.4.3 simple effects, 9.4.3 , 9.4.3 simple interactions, 9.4.2 , 9.4.2 three by three design, 8.4 , 8.4.5 interaction contrast, 8.4.4 , 8.4.4 partial interactions, 8.4.3 , 8.4.3 simple contrasts, 8.4.2 , 8.4.2 simple effects, 8.4.1 , 8.4.1 three by two by two design, see two by two by three design three by two design, see two by three design three-way interactions categorical by categorical by categorical, see categorical by categorical by categorical interactions continuous by continuous by categorical interactions, see continuous by continuous by categorical interactions continuous by continuous by continuous, see continuous by continuous by continuous interactions linear by categorical by categorical interactions, see linear by categorical by categorical interactions linear by linear by categorical interactions, see linear by linear by categorical interactions linear by quadratic by categorical interactions, see linear by quadratic by categorical interactions time, modeled categorically, 17.1 , 17.7 split plot design, 17.3 , 17.4 time by categorical interaction, 17.3 , 17.4 time modeled alone, 17.2 , 17.2 time, modeled continuously, 16.1 , 16.6 categorical by time piecewise interaction, 16.5 , 16.5.4 linear effect of time, 16.2 , 16.2 time by categorical interaction, 16.3 , 16.3 time piecewise, 16.4 , 16.4 Tukey adjustments, E , E two by three design, 8.3 , 8.3.3 partial interactions, 8.3.1 , 8.3.1 , 8.3.2 , 8.3.2 simple contrasts, 8.3.2 , 8.3.2 simple effects, 8.3.1 , 8.3.1 , 8.3.2 , 8.3.2 two by two by three design, 9.3 , 9.3.4 partial interactions, 9.3.4 , 9.3.4 simple contrasts, 9.3.3 , 9.3.3 simple interactions, 9.3.1 , 9.3.1 simple partial interactions, 9.3.2 , 9.3.2 two by two by two design, 9.2 , 9.2.3 simple effects, 9.2.3 , 9.2.3 simple interactions, 9.2.1 , 9.2.2 two by two design, 8.2 , 8.2.4 simple effects, 8.2.1 , 8.2.3 two-level categorical predictor, 7.2 , 7.2 two-way interactions categorical by categorical, see categorical by categorical interactions continuous by continuous, see continuous by continuous interactions cubic by categorical, see cubic by categorical interactions linear by categorical, see linear by categorical interactions piecewise by categorical, see piecewise by categorical interactions quadratic by categorical, see quadratic by categorical interactions U unadjusted means, 10.2.2 , 10.2.2 unbalanced designs, 8.5 , 8.5 U-shape, 3.2.1 , 3.2.1 W weighted contrasts, 7.11 , 7.11 within subjects models, see time, modeled categorically 目录 Tables Figures Preface to the Second Edition Preface to the First Edition Acknowledgments Introduction 1.1 Read me first 1.2 The GSS dataset 1.2.1 Income 1.2.2 Age 1.2.3 Education 1.2.4 Gender 1.3 The pain datasets 1.4 The optimism datasets 1.5 The school datasets 1.6 The sleep datasets 1.7 Overview of the book I Continuous predictors Continuous predictors: Linear 2.1 Chapter overview 2.2 Simple linear regression 2.2.1 Computing predicted means using the margins command 2.2.2 Graphing predicted means using the marginsplot command 2.3 Multiple regression 2.3.1 Computing adjusted means using the margins command 2.3.2 Some technical details about adjusted means 2.3.3 Graphing adjusted means using the marginsplot command 2.4 Checking for nonlinearity graphically 2.4.1 Using scatterplots to check for nonlinearity 2.4.2 Checking for nonlinearity using residuals 2.4.3 Checking for nonlinearity using locally weighted smoother 2.4.4 Graphing outcome mean at each level of predictor 2.4.5 Summary 11 12 18 19 21 22 23 26 27 28 32 34 35 36 37 38 39 41 42 43 44 47 49 53 53 55 56 58 58 59 60 62 65 2.5 Checking for nonlinearity analytically 2.5.1 Adding power terms 2.5.2 Using factor variables 2.6 Summary 66 66 69 74 Continuous predictors: Polynomials 75 3.1 Chapter overview 3.2 Quadratic (squared) terms 3.2.1 Overview 3.2.2 Examples Interpreting the relationship between age and income Graphing adjusted means with confidence intervals 3.3 Cubic (third power) terms 3.3.1 Overview 3.3.2 Examples 3.4 Fractional polynomial regression 3.4.1 Overview 3.4.2 Example using fractional polynomial regression 3.5 Main effects with polynomial terms 3.6 Summary 76 77 77 80 83 85 87 87 87 94 94 97 107 109 Continuous predictors: Piecewise models 110 4.1 Chapter overview 4.2 Introduction to piecewise regression models 4.3 Piecewise with one known knot 4.3.1 Overview 4.3.2 Examples using the GSS Individual slope coding Change in slope coding Summary 4.4 Piecewise with two known knots 4.4.1 Overview 4.4.2 Examples using the GSS 4.5 Piecewise with one knot and one jump 4.5.1 Overview 4.5.2 Examples using the GSS 4.6 Piecewise with two knots and two jumps 4.6.1 Overview 4.6.2 Examples using the GSS 111 112 115 115 115 116 120 122 124 124 124 130 130 130 136 136 136 4.7 Piecewise with an unknown knot 144 4.8 Piecewise model with multiple unknown knots 4.9 Piecewise models and the marginsplot command 4.10 Automating graphs of piecewise models 4.11 Summary 148 155 158 162 Continuous by continuous interactions 163 5.1 Chapter overview 5.2 Linear by linear interactions 5.2.1 Overview 5.2.2 Example using GSS data 5.2.3 Interpreting the interaction in terms of age 5.2.4 Interpreting the interaction in terms of education 5.2.5 Interpreting the interaction in terms of age slope 5.2.6 Interpreting the interaction in terms of the educ slope 5.3 Linear by quadratic interactions 5.3.1 Overview 5.3.2 Example using GSS data 5.4 Summary 164 165 165 169 170 172 174 175 178 178 180 185 Continuous by continuous by continuous interactions 186 6.1 Chapter overview 6.2 Overview 6.3 Examples using the GSS data 6.3.1 A model without a three-way interaction 6.3.2 A three-way interaction model Visualizing the three-way interaction Visualizing the age slope 6.4 Summary II Categorical predictors Categorical predictors 7.1 Chapter overview 7.2 Comparing two groups using a t test 7.3 More groups and more predictors 7.4 Overview of contrast operators 7.5 Compare each group against a reference group 7.5.1 Selecting a specific contrast 7.5.2 Selecting a different reference group 187 188 193 193 196 198 201 203 204 205 206 207 209 215 217 217 218 7.5.3 Selecting a contrast and reference group 7.6 Compare each group against the grand mean 219 221 7.6.1 Selecting a specific contrast 7.7 Compare adjacent means 7.7.1 Reverse adjacent contrasts 7.7.2 Selecting a specific contrast 7.8 Comparing the mean of subsequent or previous levels 7.8.1 Comparing the mean of previous levels 7.8.2 Selecting a specific contrast 7.9 Polynomial contrasts 7.10 Custom contrasts 7.11 Weighted contrasts 7.12 Pairwise comparisons 7.13 Interpreting confidence intervals 7.14 Testing categorical variables using regression 7.15 Summary 222 224 228 229 231 235 235 237 240 244 247 249 251 255 Categorical by categorical interactions 256 8.1 Chapter overview 8.2 Two by two models: Example 8.2.1 Simple effects 8.2.2 Estimating the size of the interaction 8.2.3 More about interaction 8.2.4 Summary 8.3 Two by three models 8.3.1 Example Simple effects Partial interactions 8.3.2 Example Simple effects Simple contrasts Partial interaction 8.3.3 Summary 8.4 Three by three models: Example 8.4.1 Simple effects 8.4.2 Simple contrasts 8.4.3 Partial interaction 8.4.4 Interaction contrasts 257 259 263 264 264 265 267 267 269 270 272 274 275 276 277 278 280 281 282 284 8.4.5 Summary 8.5 Unbalanced designs 286 287 8.6 Main effects with interactions: anova versus regress 8.7 Interpreting confidence intervals 8.8 Summary 292 296 299 Categorical by categorical by categorical interactions 9.1 Chapter overview 9.2 Two by two by two models 9.2.1 Simple interactions by season 9.2.2 Simple interactions by depression status 9.2.3 Simple effects 9.3 Two by two by three models 9.3.1 Simple interactions by depression status 9.3.2 Simple partial interaction by depression status 9.3.3 Simple contrasts 9.3.4 Partial interactions 9.4 Three by three by three models and beyond 9.4.1 Partial interactions and interaction contrasts 9.4.2 Simple interactions 9.4.3 Simple effects and simple comparisons 9.5 Summary III Continuous and categorical predictors 10 Linear by categorical interactions 10.1 Chapter overview 10.2 Linear and two-level categorical: No interaction 10.2.1 Overview 10.2.2 Examples using the GSS Adjusted means Unadjusted means Summary 10.3 Linear by two-level categorical interactions 10.3.1 Overview 10.3.2 Examples using the GSS Estimates of slopes Estimates and contrasts on means 10.4 Linear by three-level categorical interactions 300 301 302 304 305 306 308 309 310 312 312 315 317 320 323 324 325 326 327 328 328 330 333 334 335 336 336 338 341 341 345 10.4.1 Overview 10.4.2 Examples using the GSS Estimates and contrasts on slopes 345 347 349 Estimates and contrasts on means 10.5 Summary 351 355 11 Polynomial by categorical interactions 356 11.1 Chapter overview 11.2 Quadratic by categorical interactions 11.2.1 Overview 11.2.2 Quadratic by two-level categorical 11.2.3 Quadratic by three-level categorical 11.3 Cubic by categorical interactions 11.4 Summary 357 358 358 361 369 376 381 12 Piecewise by categorical interactions 12.1 Chapter overview 12.2 One knot and one jump 12.2.1 Comparing slopes across gender 12.2.2 Comparing slopes across education 12.2.3 Difference in differences of slopes 12.2.4 Comparing changes in intercepts 12.2.5 Computing and comparing adjusted means 12.2.6 Graphing adjusted means 12.3 Two knots and two jumps 12.3.1 Comparing slopes across gender 12.3.2 Comparing slopes across education 12.3.3 Difference in differences of slopes 12.3.4 Comparing changes in intercepts by gender 12.3.5 Comparing changes in intercepts by education 12.3.6 Computing and comparing adjusted means 12.3.7 Graphing adjusted means 12.4 Comparing coding schemes 12.4.1 Coding scheme #1 12.4.2 Coding scheme #2 12.4.3 Coding scheme #3 12.4.4 Coding scheme #4 12.4.5 Choosing coding schemes 12.5 Summary 382 383 386 390 390 391 392 392 395 400 404 405 406 407 408 409 411 415 415 416 418 419 421 422 13 Continuous by continuous by categorical interactions 423 13.1 Chapter overview 13.2 Linear by linear by categorical interactions 13.2.1 Fitting separate models for males and females 13.2.2 Fitting a combined model for males and females 13.2.3 Interpreting the interaction focusing in the age slope 13.2.4 Interpreting the interaction focusing on the educ slope 13.2.5 Estimating and comparing adjusted means by gender 13.3 Linear by quadratic by categorical interactions 13.3.1 Fitting separate models for males and females 13.3.2 Fitting a common model for males and females 13.3.3 Interpreting the interaction 13.3.4 Estimating and comparing adjusted means by gender 13.4 Summary 424 425 425 427 429 431 433 436 436 438 440 441 444 14 Continuous by categorical by categorical interactions 445 14.1 Chapter overview 14.2 Simple effects of gender on the age slope 14.3 Simple effects of education on the age slope 14.4 Simple contrasts on education for the age slope 14.5 Partial interaction on education for the age slope 14.6 Summary IV Beyond ordinary linear regression 15 Multilevel models 15.1 Chapter overview 15.2 Example 1: Continuous by continuous interaction 15.3 Example 2: Continuous by categorical interaction 15.4 Example 3: Categorical by continuous interaction 15.5 Example 4: Categorical by categorical interaction 15.6 Summary 16 Time as a continuous predictor 16.1 Chapter overview 16.2 Example 1: Linear effect of time 16.3 Example 2: Linear effect of time by a categorical predictor 16.4 Example 3: Piecewise modeling of time 16.5 Example 4: Piecewise effects of time by a categorical predictor 16.5.1 Baseline slopes 446 452 453 454 455 456 457 458 459 460 464 468 472 476 477 478 479 484 490 496 500 16.5.2 Change in slopes: Treatment versus baseline 16.5.3 Jump at treatment 16.5.4 Comparisons among groups 16.6 Summary 17 Time as a categorical predictor 17.1 Chapter overview 17.2 Example 1: Time treated as a categorical variable 17.3 Example 2: Time (categorical) by two groups 17.4 Example 3: Time (categorical) by three groups 17.5 Comparing models with different residual covariance structures 17.6 Analyses with small samples 17.7 Summary 18 Nonlinear models 18.1 Chapter overview 18.2 Binary logistic regression 18.2.1 A logistic model with one categorical predictor Using the contrast command Using the pwcompare command Using the margins and marginsplot commands Using the margins command with the pwcompare option 18.2.2 A logistic model with one continuous predictor 18.2.3 A logistic model with covariates 18.3 Multinomial logistic regression 18.4 Ordinal logistic regression 18.5 Poisson regression 18.6 More applications of nonlinear models 18.6.1 Categorical by categorical interaction 18.6.2 Categorical by continuous interaction 18.6.3 Piecewise modeling 18.7 Summary 19 Complex survey data V Appendices A Customizing output from estimation commands A.1 Omission of output A.2 Specifying the confidence level A.3 Customizing the formatting of columns in the coefficient table 501 502 503 506 507 508 509 516 521 526 529 538 539 540 541 541 541 543 543 546 548 550 556 562 565 568 568 574 580 587 588 593 594 595 597 599 A.4 Customizing the display of factor variables B The margins command B.1 The predict() and expression() options B.2 The at() option B.3 Margins with factor variables B.4 Margins with factor variables and the at() option B.5 The dydx() and related options B.6 Specifying the confidence level B.7 Customizing column formatting C The marginsplot command D The contrast command D.1 Inclusion and omission of output D.2 Customizing the display of factor variables D.3 Adjustments for multiple comparisons D.4 Specifying the confidence level D.5 Customizing column formatting E The pwcompare command References Author index Subject index 602 611 612 615 619 626 629 633 635 638 652 654 657 659 660 661 663 669 672 675 ... model with one categorical predictor Using the contrast command Using the pwcompare command Using the margins and marginsplot commands Using the margins command with the pwcompare option 18.2.2... separate models for males and females 13.2.2 Fitting a combined model for males and females 13.2.3 Interpreting the interaction focusing in the age slope 13.2.4 Interpreting the interaction focusing... linear regression 2.2.1 Computing predicted means using the margins command 2.2.2 Graphing predicted means using the marginsplot command 2.3 Multiple regression 2.3.1 Computing adjusted means using

Ngày đăng: 01/09/2021, 15:25

Mục lục

    Preface to the Second Edition

    Preface to the First Edition

    1.7 Overview of the book

    2.2.1 Computing predicted means using the margins command

    2.2.2 Graphing predicted means using the marginsplot command

    2.3.1 Computing adjusted means using the margins command

    2.3.2 Some technical details about adjusted means

    2.3.3 Graphing adjusted means using the marginsplot command

    2.4 Checking for nonlinearity graphically

    2.4.1 Using scatterplots to check for nonlinearity

Tài liệu cùng người dùng

Tài liệu liên quan