Behavioral Research Data Analysis with R
von: Yuelin Li, Jonathan Baron
Springer-Verlag, 2011
ISBN: 9781461412380
Sprache: Englisch
245 Seiten, Download: 2431 KB
Format: PDF, auch als Online-Lesen
Behavioral Research Data Analysis with R | 3 | ||
Preface | 5 | ||
Contents | 9 | ||
Chapter 1 Introduction | 13 | ||
1.1 An Example R Session | 13 | ||
1.2 A Few Useful Concepts and Commands | 15 | ||
1.2.1 Concepts | 15 | ||
1.2.2 Commands | 16 | ||
1.2.2.1 Working Directory | 16 | ||
1.2.2.2 Getting Help | 17 | ||
1.2.2.3 Installing Packages | 18 | ||
1.2.2.4 Assignment, Logic, and Arithmetic | 18 | ||
1.2.2.5 Loading and Saving | 20 | ||
1.2.2.6 Dealing with Objects | 21 | ||
1.3 Data Objects and Data Types | 21 | ||
1.3.1 Vectors of Character Strings | 22 | ||
1.3.2 Matrices, Lists, and Data Frames | 24 | ||
1.3.2.1 Summaries and Calculations by Row, Column, or Group | 26 | ||
1.4 Functions and Debugging | 27 | ||
Chapter 2 Reading and Transforming Data Format | 30 | ||
2.1 Reading and Transforming Data | 30 | ||
2.1.1 Data Layout | 30 | ||
2.1.2 A Simple Questionnaire Example | 30 | ||
2.1.2.1 Extracting Subsets of Data | 31 | ||
2.1.2.2 Finding Means (or Other Things) of Sets of Variables | 32 | ||
2.1.2.3 One Row Per Observation | 32 | ||
2.1.3 Other Ways to Read in Data | 36 | ||
2.1.4 Other Ways to Transform Variables | 37 | ||
2.1.4.1 Contrasts | 37 | ||
2.1.4.2 Averaging Items in a Within-Subject Design | 38 | ||
2.1.4.3 Selecting Cases or Variables | 39 | ||
2.1.4.4 Recoding and Replacing Data | 39 | ||
2.1.4.5 Replacing Characters with Numbers | 41 | ||
2.1.5 Using R to Compute Course Grades | 41 | ||
2.2 Reshape and Merge Data Frames | 42 | ||
2.3 Data Management with a SQL Database | 44 | ||
2.4 SQL Database Considerations | 46 | ||
Chapter 3 Statistics for Comparing Means and Proportions | 49 | ||
3.1 Comparing Means of Continuous Variables | 49 | ||
3.2 More on Manual Checking of Data | 52 | ||
3.3 Comparing Sample Proportions | 53 | ||
3.4 Moderating Effect in loglin() | 55 | ||
3.5 Assessing Change of Correlated Proportions | 59 | ||
3.5.1 McNemar Test Across Two Samples | 60 | ||
Chapter 4 R Graphics and Trellis Plots | 65 | ||
4.1 Default Behavior of Basic Commands | 65 | ||
4.2 Other Graphics | 66 | ||
4.3 Saving Graphics | 66 | ||
4.4 Multiple Figures on One Screen | 67 | ||
4.5 Other Graphics Tricks | 67 | ||
4.6 Examples of Simple Graphs in Publications | 68 | ||
4.6.1 http://journal.sjdm.org/8827/jdm8827.pdf | 70 | ||
4.6.2 http://journal.sjdm.org/8814/jdm8814.pdf | 73 | ||
4.6.3 http://journal.sjdm.org/8801/jdm8801.pdf | 74 | ||
4.6.4 http://journal.sjdm.org/8319/jdm8319.pdf | 75 | ||
4.6.5 http://journal.sjdm.org/8221/jdm8221.pdf | 76 | ||
4.6.6 http://journal.sjdm.org/8210/jdm8210.pdf | 78 | ||
4.7 Shaded Areas Under a Curve | 79 | ||
4.7.1 Vectors in polygon() | 81 | ||
4.8 Lattice Graphics | 82 | ||
4.8.0.1 Mathematics Achievement and Socioeconomic Status | 82 | ||
Chapter 5 Analysis of Variance: Repeated-Measures | 88 | ||
5.1 Example 1: Two Within-Subject Factors | 88 | ||
5.1.1 Unbalanced Designs | 92 | ||
5.2 Example 2: Maxwell and Delaney | 94 | ||
5.3 Example 3: More Than Two Within-Subject Factors | 97 | ||
5.4 Example 4: A Simpler Design with Only One Within-Subject Variable | 98 | ||
5.5 Example 5: One Between, Two Within | 98 | ||
5.6 Other Useful Functions for ANOVA | 100 | ||
5.7 Graphics with Error Bars | 102 | ||
5.8 Another Way to do Error Bars Using plotCI() | 104 | ||
5.8.1 Use Error() for Repeated-Measure ANOVA | 105 | ||
5.8.1.1 Basic ANOVA Table with aov() | 106 | ||
5.8.1.2 Using Error() Within aov() | 107 | ||
5.8.1.3 The Appropriate Error Terms | 107 | ||
5.8.1.4 Sources of the Appropriate Error Terms | 108 | ||
5.8.1.5 Verify the Calculations Manually | 110 | ||
5.8.2 Sphericity | 111 | ||
5.8.2.1 Why Is Sphericity Important? | 111 | ||
5.9 How to Estimate the Greenhouse–Geisser Epsilon? | 112 | ||
5.9.1 Huynh–Feldt Correction | 1 | ||
Chapter 6 Linear and Logistic Regression | 117 | ||
6.1 Linear Regression | 117 | ||
6.2 An Application of Linear Regression on Diamond Pricing | 118 | ||
6.2.1 Plotting Data Before Model Fitting | 119 | ||
6.2.2 Checking Model Distributional Assumptions | 122 | ||
6.2.3 Assessing Model Fit | 123 | ||
6.3 Logistic Regression | 126 | ||
6.4 Log–Linear Models | 127 | ||
6.5 Regression in Vector–Matrix Notation | 128 | ||
6.6 Caution on Model Overfit and Classification Errors | 130 | ||
Chapter 7 Statistical Power and Sample Size Considerations | 136 | ||
7.1 A Simple Example | 136 | ||
7.2 Basic Concepts on Statistical Power Estimation | 137 | ||
7.3 t-Test with Unequal Sample Sizes | 138 | ||
7.4 Binomial Proportions | 139 | ||
7.5 Power to Declare a Study Feasible | 140 | ||
7.6 Repeated-Measures ANOVA | 140 | ||
7.7 Cluster-Randomized Study Design | 142 | ||
Chapter 8 Item Response Theory | 145 | ||
8.1 Overview | 145 | ||
8.2 Rasch Model for Dichotomous Item Responses | 145 | ||
8.2.1 Fitting a rasch() Model | 146 | ||
8.2.2 Graphing Item Characteristics and Item Information | 149 | ||
8.2.3 Scoring New Item Response Data | 151 | ||
8.2.4 Person Fit and Item Fit Statistics | 151 | ||
8.3 Generalized Partial Credit Model for Polytomous ItemResponses | 152 | ||
8.3.1 Neuroticism Data | 153 | ||
8.3.2 Category Response Curves and Item InformationCurves | 153 | ||
8.4 Bayesian Methods for Fitting IRT Models | 155 | ||
8.4.1 GPCM | 155 | ||
8.4.2 Explanatory IRT | 158 | ||
Chapter 9 Imputation of Missing Data | 166 | ||
9.1 Missing Data in Smoking Cessation Study | 166 | ||
9.2 Multiple Imputation with aregImpute() | 168 | ||
9.2.1 Imputed Data | 170 | ||
9.2.2 Pooling Results Over Imputed Datasets | 171 | ||
9.3 Multiple Imputation with the mi Package | 173 | ||
9.4 Multiple Imputation with the Amelia and Zelig Packages | 176 | ||
9.5 Further Reading | 178 | ||
Chapter 10 Linear Mixed-Effects Models in Analyzing Repeated-Measures Data | 181 | ||
10.1 The "Language-as-Fixed-Effect Fallacy' | 181 | ||
10.2 Recall Scores Example: One Between and One Within Factor | 184 | ||
10.2.1 Data Preparations | 184 | ||
10.2.2 Data Visualizations | 185 | ||
10.2.3 Initial Modeling | 186 | ||
10.2.4 Model Interpretation | 186 | ||
10.2.4.1 Fixed Effects | 186 | ||
10.2.4.2 Random Effects | 189 | ||
10.2.5 Alternative Models | 190 | ||
10.2.6 Checking Model Fit Visually | 193 | ||
10.2.7 Modeling Dependence | 194 | ||
10.3 Generalized Least Squares Using gls() | 199 | ||
10.4 Example on Random and Nested Effects | 202 | ||
10.4.1 Treatment by Therapist Interaction | 204 | ||
Chapter 11 Linear Mixed-Effects Models in Cluster-Randomized Studies | 209 | ||
11.1 The Television, School, and Family Smoking Prevention and Cessation Project | 209 | ||
11.2 Data Import and Preparations | 210 | ||
11.2.1 Exploratory Analyses | 211 | ||
11.3 Testing Intervention Efficacy with Linear Mixed-Effects Models | 214 | ||
11.4 Model Equation | 217 | ||
11.5 Multiple-Level Model Equations | 219 | ||
11.6 Model Equation in Matrix Notations | 220 | ||
11.7 Intraclass Correlation Coefficients | 224 | ||
11.8 ICCs from a Mixed-Effects Model | 225 | ||
11.9 Statistical Power Considerationsfor a Group-Randomized Design | 227 | ||
11.9.1 Calculate Statistical Power by Simulation | 227 | ||
Appendix A Data Management with a Database | 232 | ||
A.1 Create Database and Database Tables | 232 | ||
A.2 Enter Data | 233 | ||
A.3 Using RODBC to Import Data from an ACCESS Database | 235 | ||
A.3.1 Step 1: Adding an ODBC Data Source Name | 236 | ||
A.3.2 Step 2: ODBC Data Source Name Points to the ACCESS File | 236 | ||
A.3.3 Step 3: Run RODBC to Import Data | 237 | ||
References | 239 | ||
Index | 244 |