List of Figures |
|
xiii | |
List of Tables |
|
xxi | |
Foreword |
|
xxiii | |
Preface |
|
xxv | |
Acknowledgments |
|
xxxi | |
1 An Introduction to R |
|
1 | (20) |
|
|
2 | (2) |
|
|
2 | (1) |
|
|
2 | (1) |
|
|
2 | (2) |
|
1.2 Arithmetic: R as a Calculator |
|
|
4 | (1) |
|
1.3 Computations in R: Functions |
|
|
4 | (3) |
|
1.4 Connecting Computations |
|
|
7 | (2) |
|
|
8 | (1) |
|
1.5 Data Structures: Vectors |
|
|
9 | (4) |
|
1.5.1 Creating Vectors in R |
|
|
9 | (2) |
|
1.5.2 Computation with Vectors |
|
|
11 | (1) |
|
1.5.3 Character and Logical Vectors |
|
|
12 | (1) |
|
|
13 | (1) |
|
1.7 Alternative Ways to Run R |
|
|
14 | (1) |
|
1.8 Extension: Matrices and Matrix Operations |
|
|
14 | (4) |
|
1.8.1 Computation with Matrices |
|
|
15 | (3) |
|
|
18 | (1) |
|
|
19 | (2) |
2 Data Representation and Preparation |
|
21 | (28) |
|
|
23 | (1) |
|
2.1.1 External Formats for Storing Tabular Data |
|
|
23 | (1) |
|
|
24 | (1) |
|
|
25 | (1) |
|
2.3 Reading Delimited Data into R |
|
|
25 | (4) |
|
2.3.1 Identifying the Location of a File |
|
|
26 | (2) |
|
2.3.2 Examining the Data in a Text Editor |
|
|
28 | (1) |
|
2.3.3 Reading Delimited Separated Data: An Example |
|
|
28 | (1) |
|
2.4 Data Structure: Data Frames |
|
|
29 | (4) |
|
2.4.1 Examining the Data Read into R |
|
|
29 | (4) |
|
2.5 Recording Syntax using Script Files |
|
|
33 | (1) |
|
|
34 | (1) |
|
|
34 | (3) |
|
2.6.1 Saving Graphics to Insert into a Word-Processing File |
|
|
35 | (2) |
|
2.7 Extension: Logical Expressions and Graphs for Categorical Variables |
|
|
37 | (8) |
|
|
38 | (2) |
|
2.7.2 Measurement Level and Analysis |
|
|
40 | (2) |
|
|
42 | (2) |
|
2.7.4 Plotting Categorical Data |
|
|
44 | (1) |
|
|
45 | (1) |
|
|
46 | (3) |
3 Data Exploration: One Variable |
|
49 | (16) |
|
|
50 | (2) |
|
3.2 Nonparametric Density Estimation |
|
|
52 | (6) |
|
3.2.1 Graphically Summarizing the Distribution |
|
|
52 | (1) |
|
|
52 | (1) |
|
3.2.3 Kernel Density Estimators |
|
|
53 | (1) |
|
3.2.4 Controlling the Density Estimation |
|
|
53 | (2) |
|
3.2.5 Plotting the Estimated Density |
|
|
55 | (3) |
|
3.3 Summarizing the Findings |
|
|
58 | (4) |
|
3.3.1 Creating a Plot for Publication |
|
|
59 | (2) |
|
3.3.2 Writing Up the Results for Publication |
|
|
61 | (1) |
|
3.4 Extension: Variability Bands for Kernel Densities |
|
|
62 | (1) |
|
|
62 | (1) |
|
|
63 | (2) |
4 Exploration of Multivariate Data: Comparing Two Groups |
|
65 | (28) |
|
4.1 Graphically Summarizing the Marginal Distribution |
|
|
66 | (1) |
|
4.2 Graphically Summarizing Conditional Distributions |
|
|
66 | (6) |
|
4.2.1 Indexing: Accessing Individuals or Subsets |
|
|
68 | (1) |
|
4.2.2 Indexing Using a Logical Expression |
|
|
69 | (1) |
|
4.2.3 Density Plots of the Conditional Distributions |
|
|
70 | (1) |
|
4.2.4 Side-by-Side Box-and-Whiskers Plots |
|
|
70 | (2) |
|
4.3 Numerical Summaries of Data: Estimates of the Population Parameters |
|
|
72 | (8) |
|
4.3.1 Measuring Central Tendency |
|
|
73 | (1) |
|
4.3.2 Measuring Variation |
|
|
74 | (2) |
|
|
76 | (2) |
|
|
78 | (2) |
|
4.4 Summarizing the Findings |
|
|
80 | (7) |
|
4.4.1 Creating a Plot for Publication |
|
|
80 | (1) |
|
|
81 | (4) |
|
4.4.3 Selecting a Color Palette |
|
|
85 | (2) |
|
4.5 Extension: Robust Estimation |
|
|
87 | (4) |
|
4.5.1 Robust Estimate of Location: The Trimmed Mean |
|
|
87 | (2) |
|
4.5.2 Robust Estimate of Variation: The Winsorized Variance |
|
|
89 | (2) |
|
|
91 | (1) |
|
|
91 | (2) |
5 Exploration of Multivariate Data: Comparing Many Groups |
|
93 | (22) |
|
5.1 Graphing Many Conditional Distributions |
|
|
94 | (6) |
|
|
96 | (1) |
|
5.1.2 Side-by-Side Box-and-Whiskers Plots |
|
|
97 | (3) |
|
5.2 Numerically Summarizing the Data |
|
|
100 | (1) |
|
5.3 Summarizing the Findings |
|
|
101 | (2) |
|
5.3.1 Writing Up the Results for Publication |
|
|
102 | (1) |
|
5.3.2 Enhancing a Plot with a Line |
|
|
102 | (1) |
|
5.4 Examining Distributions Conditional on Multiple Variables |
|
|
103 | (4) |
|
5.5 Extension: Conditioning on Continuous Variables |
|
|
107 | (5) |
|
5.5.1 Scatterplots of the Conditional Distributions |
|
|
110 | (2) |
|
|
112 | (1) |
|
|
113 | (2) |
6 Randomization and Permutation Tests |
|
115 | (22) |
|
6.1 Randomized Experimental Research |
|
|
118 | (1) |
|
6.2 Introduction to the Randomization Test |
|
|
119 | (3) |
|
6.3 Randomization Tests with Large Samples: Monte Carlo Simulation |
|
|
122 | (8) |
|
6.3.1 Rerandomization of the Data |
|
|
124 | (1) |
|
6.3.2 Repeating the Randomization Process |
|
|
125 | (1) |
|
6.3.3 Generalizing Processes: Functions |
|
|
126 | (1) |
|
6.3.4 Repeated Operations on Matrix Rows or Columns |
|
|
127 | (1) |
|
6.3.5 Examining the Monte Carlo Distribution and Obtaining the p-Value |
|
|
127 | (3) |
|
6.4 Validity of the Inferences and Conclusions Drawn from a Randomization Test |
|
|
130 | (2) |
|
|
130 | (1) |
|
6.4.2 Nonexperimental Research: Permutation Tests |
|
|
131 | (1) |
|
6.4.3 Nonexperimental, Nongeneralizable Research |
|
|
131 | (1) |
|
6.5 Generalization from the Randomization Results |
|
|
132 | (1) |
|
6.6 Summarizing the Results for Publication |
|
|
133 | (1) |
|
6.7 Extension: Tests of the Variance |
|
|
133 | (1) |
|
|
134 | (1) |
|
|
135 | (2) |
7 Bootstrap Tests |
|
137 | (34) |
|
7.1 Educational Achievement of Latino Immigrants |
|
|
138 | (2) |
|
7.2 Probability Models: An Interlude |
|
|
140 | (1) |
|
7.3 Theoretical Probability Models in R |
|
|
141 | (2) |
|
7.4 Parametric Bootstrap Tests |
|
|
143 | (3) |
|
7.4.1 Choosing a Probability Model |
|
|
144 | (1) |
|
7.4.2 Standardizing the Distribution of Achievement Scores |
|
|
144 | (2) |
|
7.5 The Parametric Bootstrap |
|
|
146 | (2) |
|
7.5.1 The Parametric Bootstrap: Approximating the Distribution of the Mean Difference |
|
|
146 | (2) |
|
7.6 Implementing the Parametric Bootstrap in R |
|
|
148 | (6) |
|
7.6.1 Writing a Function to Randomly Generate Data for the boot() Function |
|
|
148 | (2) |
|
7.6.2 Writing a Function to Compute a Test Statistic Using the Randomly Generated Data |
|
|
150 | (1) |
|
7.6.3 The Bootstrap Distribution of the Mean Difference |
|
|
151 | (3) |
|
7.7 Summarizing the Results of the Parametric Bootstrap Test |
|
|
154 | (1) |
|
7.8 Nonparametric Bootstrap Tests |
|
|
154 | (6) |
|
7.8.1 Using the Nonparametric Bootstrap to Approximate the Distribution of the Mean Difference |
|
|
157 | (1) |
|
7.8.2 Implementing the Nonparametric Bootstrap in R |
|
|
158 | (2) |
|
7.9 Summarizing the Results for the Nonparametric Bootstrap Test |
|
|
160 | (1) |
|
7.10 Bootstrapping Using a Pivot Statistic |
|
|
161 | (3) |
|
7.10.1 Student's t-Statistic |
|
|
161 | (3) |
|
7.11 Independence Assumption for the Bootstrap Methods |
|
|
164 | (2) |
|
7.12 Extension: Testing Functions |
|
|
166 | (2) |
|
7.12.1 Ordering a Data Frame |
|
|
166 | (2) |
|
|
168 | (1) |
|
|
168 | (3) |
8 Philosophical Considerations |
|
171 | (8) |
|
8.1 The Randomization Test vs. the Bootstrap Test |
|
|
172 | (1) |
|
8.2 Philosophical Frameworks of Classical Inference |
|
|
173 | (6) |
|
8.2.1 Fisher's Significance Testing |
|
|
174 | (1) |
|
8.2.2 Neyman-Pearson Hypothesis Testing |
|
|
175 | (1) |
|
|
176 | (3) |
9 Bootstrap Intervals and Effect Sizes |
|
179 | (26) |
|
9.1 Educational Achievement Among Latino Immigrants: Example Revisited |
|
|
180 | (1) |
|
9.2 Plausible Models to Reproduce the Observed Result |
|
|
180 | (5) |
|
9.2.1 Computing the Likelihood of Reproducing the Observed Result |
|
|
181 | (4) |
|
9.3 Bootstrapping Using an Alternative Model |
|
|
185 | (6) |
|
9.3.1 Using R to Bootstrap under the Alternative Model |
|
|
187 | (3) |
|
9.3.2 Using the Bootstrap Distribution to Compute the Interval Limits |
|
|
190 | (1) |
|
9.3.3 Historical Interlude: Student's Approximation for the Interval Estimate |
|
|
190 | (1) |
|
9.3.4 Studentized Bootstrap Interval |
|
|
191 | (1) |
|
9.4 Interpretation of the Interval Estimate |
|
|
191 | (1) |
|
9.5 Adjusted Bootstrap Intervals |
|
|
192 | (1) |
|
9.6 Standardized Effect Size: Quantifying the Group Differences in a Common Metric |
|
|
192 | (5) |
|
9.6.1 Effect Size as Distance-Cohen's δ |
|
|
193 | (2) |
|
9.6.2 Robust Distance Measure of Effect |
|
|
195 | (2) |
|
9.7 Summarizing the Results |
|
|
197 | (1) |
|
9.8 Extension: Bootstrapping the Confidence Envelope for a Q-Q Plot |
|
|
197 | (1) |
|
|
198 | (4) |
|
|
202 | (2) |
|
|
204 | (1) |
10 Dependent Samples |
|
205 | (22) |
|
10.1 Matching: Reducing the Likelihood of Nonequivalent Groups |
|
|
206 | (1) |
|
10.2 Mathematics Achievement Study Design |
|
|
206 | (5) |
|
10.2.1 Exploratory Analysis |
|
|
209 | (2) |
|
10.3 Randomization/Permutation Test for Dependent Samples |
|
|
211 | (5) |
|
10.3.1 Reshaping the Data |
|
|
212 | (2) |
|
10.3.2 Randomization Test Using the Reshaped Data |
|
|
214 | (2) |
|
|
216 | (1) |
|
10.5 Summarizing the Results of a Dependent Samples Test for Publication |
|
|
217 | (1) |
|
10.6 To Match or Not to Match...That is the Question |
|
|
218 | (2) |
|
10.7 Extension: Block Bootstrap |
|
|
220 | (3) |
|
|
223 | (1) |
|
|
224 | (3) |
11 Planned Contrasts |
|
227 | (26) |
|
|
228 | (1) |
|
11.2 Examination of Weight Loss Conditioned on Diet |
|
|
228 | (4) |
|
11.2.1 Exploration of Research Question 1 |
|
|
229 | (1) |
|
11.2.2 Exploration of Research Question 2 |
|
|
230 | (1) |
|
11.2.3 Exploration of Research Question 3 |
|
|
231 | (1) |
|
11.3 From Research Questions to Hypotheses |
|
|
232 | (1) |
|
11.4 Statistical Contrasts |
|
|
233 | (4) |
|
|
236 | (1) |
|
11.5 Computing the Estimated Contrasts Using the Observed Data |
|
|
237 | (2) |
|
11.6 Testing Contrasts: Randomization Test |
|
|
239 | (1) |
|
11.7 Strength of Association: A Measure of Effect |
|
|
240 | (3) |
|
11.7.1 Total Sum of Squares |
|
|
241 | (2) |
|
11.8 Contrast Sum of Squares |
|
|
243 | (1) |
|
11.9 Eta-Squared for Contrasts |
|
|
243 | (1) |
|
11.10 Bootstrap Interval for Eta-Squared |
|
|
244 | (1) |
|
11.11 Summarizing the Results of a Planned Contrast Test Analysis |
|
|
245 | (1) |
|
11.12 Extension: Orthogonal Contrasts |
|
|
245 | (6) |
|
|
251 | (1) |
|
|
251 | (2) |
12 Unplanned Contrasts |
|
253 | (32) |
|
12.1 Unplanned Comparisons |
|
|
254 | (1) |
|
12.2 Examination of Weight Loss Conditioned on Diet |
|
|
254 | (3) |
|
|
257 | (12) |
|
12.3.1 Statistical Models |
|
|
257 | (1) |
|
12.3.2 Postulating a Statistical Model to Fit the Data |
|
|
258 | (2) |
|
12.3.3 Fitting a Statistical Model to the Data |
|
|
260 | (2) |
|
12.3.4 Partitioning Variation in the Observed Scores |
|
|
262 | (6) |
|
12.3.5 Randomization Test for the Omnibus Hypothesis |
|
|
268 | (1) |
|
12.4 Group Comparisons After the Omnibus Test |
|
|
269 | (1) |
|
12.5 Ensemble-Adjusted p-values |
|
|
270 | (3) |
|
12.5.1 False Discovery Rate |
|
|
272 | (1) |
|
12.6 Strengths and Limitations of the Four Approaches |
|
|
273 | (3) |
|
12.6.1 Planned Comparisons |
|
|
273 | (1) |
|
12.6.2 Omnibus Test Followed by Unadjusted Group Comparisons |
|
|
274 | (1) |
|
12.6.3 Omnibus Test Followed by Adjusted Group Comparisons |
|
|
274 | (1) |
|
12.6.4 Adjusted Group Comparisons without the Omnibus Test |
|
|
275 | (1) |
|
|
276 | (1) |
|
12.7 Summarizing the Results of Unplanned Contrast Tests for Publication |
|
|
276 | (1) |
|
12.8 Extension: Plots of the Unplanned Contrasts |
|
|
276 | (6) |
|
12.8.1 Simultaneous Intervals |
|
|
280 | (2) |
|
|
282 | (1) |
|
|
283 | (2) |
References |
|
285 | |