R

On the Statistics of Smoking

Three classic smoking datasets analysed in R: linear and logistic regression for birth weight, a dose-response GLM for oesophageal cancer, Simpson's paradox in the Whickham survey, Wald tests by hand against likelihood-ratio and score tests, Hauck-Donner, sandwich errors, Beta-binomial and Metropolis-sampled Bayesian logistic regression, PCA and Hotelling's T-squared. Also a typeset PDF.

Solutions to Lafaye de Micheaux, Drouilhet & Liquet’s The R Software

Worked solutions to all 164 end-of-chapter exercises and 57 worksheet practicals (353 numbered worksheet questions) in The R Software: Fundamentals of Programming and Statistical Analysis (Springer, 2013) — data structures, import and export, data manipulation, plots, programming, sessions, matrix algebra and optimisation, descriptive statistics, simulation, confidence intervals and tests, linear regression and ANOVA — with executed R code and committed output throughout.

An Introduction to Statistical Learning: with Applications in R

Lab 2

The Chapter 2 lab is a tour of the language itself – vectors, matrices, indexing, plotting, and loading a data set. What follows is that tour, split into the sections the book uses.

Basic Commands

Vectors are built with c() (concatenate), and both <- and = assign. Arithmetic is element-wise, so operands must share a length – reassigning x to length 3 lets it line up with y:

Read more >

The Art of R Programming: A Tour of Statistical Software Design

Chapter 1: Getting Started

mean(abs(rnorm(100)))  # generate 100 N(0,1) variates, take abs, then mean
rnorm(10)

Chapter 2: Vectors

Chapter 3: Matrices and Arrays

Chapter 4: Lists

Chapter 5: Data Frames

Chapter 6: Factors and Tables

Chapter 7: R Programming Structures

Chapter 8: Doing Math and Simulations in R

Chapter 9: Object-Oriented Prgoramming

Chapter 10: Input/Output

Chapter 11: String Manipulation

Chapter 12: Graphics

Chapter 13: Debugging

Chapter 14: Performance Enhancement: Speed and Memory

Chapter 15: Interfacing R to Other Languages

Chapter 16: Parallel R

The R Software: Fundamentals of Programming and Statistical Analysis

Pierre Lafaye de Micheaux, Rémy Drouilhet and Benoît Liquet, The R Software: Fundamentals of Programming and Statistical Analysis, Springer Statistics and Computing 40, 2013 (translated from the French Le logiciel R). Part I introduces R and the book’s data sets; Part II covers the language (data structures, import/export, manipulation and functions, documentation, plots, programming, sessions); Part III applies it to matrices and optimisation, descriptive statistics, random variables and simulation, confidence intervals and tests, linear regression and ANOVA. Chapters 3 to 15 each end with exercises and a practical worksheet.

Read more >

Solutions to Dobson & Barnett’s An Introduction to Generalized Linear Models

Worked solutions in R to all 78 exercises in the fourth edition of Dobson & Barnett's An Introduction to Generalized Linear Models — exponential family theory, estimation and inference, normal linear models, binomial and Poisson regression, contingency tables, survival analysis, clustered and longitudinal data, and Bayesian analysis with MCMC.