Description
Written at a readily accessible level, Basic Data Analysis for Time Series with R emphasizes the mathematical importance of collaborative analysis of data used to collect increments of time or space. Balancing a theoretical and practical approach to analyzing data within the context of serial correlation, the book presents a coherent and systematic regression-based approach to model selection. The book illustrates these principles of model selection and model building through the use of information criteria, cross validation, hypothesis tests, and confidence intervals. Focusing on frequency- and time-domain and trigonometric regression as the primary themes, the book also includes modern topical coverage on Fourier series and Akaike’s Information Criterion (AIC). In addition, Basic Data Analysis for Time Series with R also features: * Real-world examples to provide readers with practical hands-on experience * Multiple R software subroutines employed with graphical displays * Numerous exercise sets intended to support readers understanding of the core concepts * Specific chapters devoted to the analysis of the Wolf sunspot number data and the Vostok ice core data sets DeWayne R. Derryberry, PhD, is Associate Professor in the Department of Mathematics and Statistics at Idaho State University. Dr. Derryberry has published more than a dozen journal articles and his research interests include meta-analysis, discriminant analysis with messy data, time series analysis of the relationship between several cancers, and geographically-weighted regression. PREFACE xv ACKNOWLEDGMENTS xvii PART I BASIC CORRELATION STRUCTURES 1 RBasics 3 1.1 Getting Started, 3 1.2 Special R Conventions, 5 1.3 Common Structures, 5 1.4 Common Functions, 6 1.5 Time Series Functions, 6 1.6 Importing Data, 7 Exercises, 7 2 Review of Regression and More About R 8 2.1 Goals of this Chapter, 8 2.2 The Simple(ST) Regression Model, 8 2.3 Simulating the Data from a Model and Estimating the Model Parameters in R, 9 2.4 Basic Inference for the Model, 12 2.5 Residuals Analysis–What Can Go Wrong…, 13 2.6 Matrix Manipulation in R, 15 Exercises, 16 3 The Modeling Approach Taken in this Book and Some Examples of Typical Serially Correlated Data 18 3.1 Signal and Noise, 18 3.2 Time Series Data, 19 3.3 Simple Regression in the Framework, 20 3.4 Real Data and Simulated Data, 20 3.5 The Diversity of Time Series Data, 21 3.6 Getting Data Into R, 24 Exercises, 26 4 Some Comments on Assumptions 28 4.1 Introduction, 28 4.2 The Normality Assumption, 29 4.3 Equal Variance, 31 4.4 Independence, 31 4.5 Power of Logarithmic Transformations Illustrated, 32 4.6 Summary, 34 Exercises, 34 5 The Autocorrelation Function And AR(1), AR(2) Models 35 5.1 Standard Models–What are the Alternatives to White Noise?, 35 5.2 Autocovariance and Autocorrelation, 36 5.3 The acf() Function in R, 37 5.4 The First Alternative to White Noise: Autoregressive Errors–AR(1), AR(2), 40 Exercises, 49 6 The Moving Average Models MA(1) And MA(2) 51 6.1 The Moving Average Model, 51 6.2 The Autocorrelation for MA(1) Models, 51 6.3 A Duality Between MA(l) And AR(m) Models, 52 6.4 The Autocorrelation for MA(2) Models, 52 6.5 Simulated Examples of the MA(1) Model, 52 6.6 Simulated Examples of the MA(2) Model, 54 6.7 AR(m) and MA(l) model acf() Plots, 54 Exercises, 57 PART II ANALYSIS OF PERIODIC DATA AND MODEL SELECTION 7 Review of Transcendental Functions and Complex Numbers 61 7.1 Background, 61 7.2 Complex Arithmetic, 62 7.3 Some Important Series, 63 7.4 Useful Facts About Periodic Transcendental Functions, 64 Exercises, 64 8 The Power Spectrum and the Periodogram 65 8.1 Introduction, 65 8.2 A Definition and a Simplified Form for p(f ), 66 8.3 Inverting p(f ) to Recover the Ck Values, 66 8.4 The Power Spectrum for Some Familiar Models, 68 8.5 The Periodogram, a Closer Look, 72 8.6 The Function spec.pgram() in R, 75 Exercises, 77 9 Smoothers, The Bias-Variance Tradeoff, and the Smoothed Periodogram 79 9.1 Why is Smoothing Required?, 79 9.2 Smoothing, Bias, and Variance, 79 9.3 Smoothers Used in R, 80 9.4 Smoothing the Periodogram for a Series With a Known and Unknown Period, 85 9.5 Summary, 87 Exercises, 87 10 A Regression Model for Periodic Data 89 10.1 The Model, 89 10.2 An Example: The NYC Temperature Data, 91 10.3 Complications 1: CO2 Data, 93 10.4 Complications 2: Sunspot Numbers, 94 10.5 Complications 3: Accidental Deaths, 96 10.6 Summary, 96 Exercises, 96 11 Model Selection and Cross-Validation 98 11.1 Background, 98 11.2 Hypothesis Tests in Simple Regression, 99 11.3 A More General Setting for Likelihood Ratio Tests, 101 11.4 A Subtlety Different Situation, 104 11.5 Information Criteria, 106 11.6 Cross-validation (Data Splitting): NYC Temperatures, 108 11.7 Summary, 112 Exercises, 113 12 Fitting Fourier series 115 12.1 Introduction: More Complex Periodic Models, 115 12.2 More Complex Periodic Behavior: Accidental Deaths, 116 12.3 The Boise River Flow data, 121 12.4 Where Do We Go from Here?, 124 Exercises, 124 13 Adjusting for AR(1) Correlation in Complex Models 125 13.1 Introduction, 125 13.2 The Two-Sample t-Test–UNCUT and Patch-Cut Forest, 125 13.3 The Second Sleuth Case–Global Warming, A Simple Regression, 132 13.4 The Semmelweis Intervention, 138 13.5 The NYC Temperatures (Adjusted), 142 13.6 The Boise River Flow Data: Model Selection With Filtering, 147 13.7 Implications of AR(1) Adjustments and the “Skip” Method, 151 13.8 Summary, 152 Exercises, 153 PART III COMPLEX TEMPORAL STRUCTURES 14 The Backshift Operator, the Impulse Response Function, and General ARMA Models 159 14.1 The General ARMA Model, 159 14.2 The Backshift (Shift, Lag) Operator, 161 14.3 The Impulse Response Operator–Intuition, 164 14.4 Impulse Response Operator, g(B)–Computation, 165 14.5 Interpretation and Utility of the Impulse Response Function, 167 Exercises, 167 15 The Yule-Walker Equations and the Partial Autocorrelation Function 169 15.1 Background, 169 15.2 Autocovariance of an ARMA(m,l) Model, 169 15.3 AR(m) and the Yule-Walker Equations, 170 15.4 The Partial Autocorrelation Plot, 174 15.5 The Spectrum For Arma Processes, 175 15.6 Summary, 177 Exercises, 178 16 Modeling Philosophy and Complete Examples 180 16.1 Modeling Overview, 180 16.2 A Complex Periodic Model–Monthly River Flows, Furnas 1931-1978, 185 16.3 A Modeling Example–Trend and Periodicity: CO2 Levels at Mauna Lau, 193 16.4 Modeling Periodicity with a Possible Intervention–Two Examples, 198 16.5 Periodic Models: Monthly, Weekly, and Daily Averages, 205 16.6 Summary, 207 Exercises, 207 PART IV SOME DETAILED AND COMPLETE EXAMPLES 17 Wolf’s Sunspot Number Data 213 17.1 Background, 213 17.2 Unknown Period ==> Nonlinear Model, 214 17.3 The Function nls() in R, 214 17.4 Determining the Period, 216 17.5 Instability in the Mean, Amplitude, and Period, 217 17.6 Data Splitting for Prediction, 220 17.7 Summary, 226 Exercises, 226 18 An Analysis of Some Prostate and Breast Cancer Data 228 18.1 Background, 228 18.2 The First Data Set, 229 18.3 The Second Data Set, 232 Exercises, 243 19 Christopher Tennant/Ben Crosby Watershed Data 245 19.1 Background and Question, 245 19.2 Looking at the Data and Fitting Fourier Series, 246 19.3 Averaging Data, 248 19.4 Results, 250 Exercises, 250 20 Vostok Ice Core Data 251 20.1 Source of the Data, 251 20.2 Background, 252 20.3 Alignment, 253 20.4 A Na?ve Analysis, 256 20.5 A Related Simulation, 259 20.6 An AR(1) Model for Irregular Spacing, 265 20.7 Summary, 269 Exercises, 270 Appendix A Using Datamarket 273 A.1 Overview, 273 A.2 Loading a Time Series in Datamarket, 277 A.3 Respecting Datamarket Licensing Agreements, 280 Appendix B AIC is PRESS! 281 B.1 Introduction, 281 B.2 PRESS, 281 B.3 Connection to Akaike’s Result, 282 B.4 Normalization and R2, 282 B.5 An example, 283 B.6 Conclusion and Further Comments, 283 Appendix C A 15-Minute Tutorial on Nonlinear Optimization 284 C.1 Introduction, 284 C.2 Newton’s Method for One-Dimensional Nonlinear Optimization, 284 C.3 A Sequence of Directions, Step Sizes, and a Stopping Rule, 285 C.4 What Could Go Wrong?, 285 C.5 Generalizing the Optimization Problem, 286 C.6 What Could Go Wrong–Revisited, 286 C.7 What Can be Done?, 287 REFERENCES 291 INDEX 293




