STSCI 4030 - Applied Linear Statistical Models - Fall 2012
Final Exam: Due December 13, 2012
Instructions: Use the R package to do the required computations. Include the R code used
to answer each part and the output requested in your solution document. E
STSCI 4030 - Applied Linear Statistical Models - Fall 2012
Preliminary Exam 2
1. Consider the following linear model with one categorical predictor and one numerical
predictor,
yij = 0 + 1 Iij + 2 Dij + 3 Iij Dij +
ij
,
(1)
for i = 1, 2 and j = 1, . . . ,
STSCI 4030 - Applied Linear Statistical Models - Fall 2012
Homework Assignment 1 - Solutions
Scottish hill races data:
(a) Construct a scatterplot of Time (y-axis) versus Distance (x-axis) using the plot function in R.
plot(Distance,Time,main=Scottish Hil
STSCI 4030 - Applied Linear Statistical Models - Fall 2012
Homework Assignment 2 - Solutions
(a) Fit a simple linear regression model with Energy as the response and
Weight as the predictor. Print the summary of the SLR t and report
the prediction equatio
R Notes for Applied Linear Statistical Models
James G. Booth Cornell University Fall 2012
MLR Analysis of Scottish Hill Racing Data From Atkinson (1986), Statistical Science 1:397-402 > hills = read.table("./data/hills.txt", sep = ", header = TRUE) > summ
STSCI 4030 - Applied Linear Statistical Models - Fall 2012
Homework Assignment 5 - Solutions
1. The dataset rubber.csv concerns an experiment to compare rubber
yields (in grams) from 7 varieties of quayule. The experiment was
arranged in ve randomized blo
STSCI 4030 - Applied Linear Statistical Models - Fall 2012
Homework Assignment 4 - Solutions
(a) Fit a model (using the lm command) with TEAM as a xed categorical
factor and GF as the response. Using the model determine the end of
season goal averages (th
STSCI/BTRY 4030 Applied Linear Statistical Model Fall 2011
Model Selection: Mallows Cp, PRESS and AIC
> # load in contributed packages are functions
> .libPaths("~/Documents/Rpackages/")
> library(leaps)
> source("myfunctions.R")
> # press and press.leaps
STSCI 4030 - Applied Linear Statistical Models - Fall 2012
Homework Assignment 3 - Due Friday, October 15
Problem 1: The data in usair.csv relate to air polution in 41 US cities
as measured by the annual mean concentration of sulphur dioxide, in microgram
R Notes for Applied Linear Statistical Models
James G. Booth
Cornell University
Fall 2012
Two factor repeated measures ANOVA
Study involving a comparison of three training regimen, control (no exercise), weight (increasing weight each month), repetition (
R Notes for Applied Linear Statistical Models
James G. Booth
Cornell University
Fall 2012
The Companion to Applied Regression Package
This package accompanies J. Fox and S. Weisberg, An R Companion to
Applied Regression, Second Edition, Sage, 2011.
The ea
STSCI/BTRY 4030 Applied Linear Statistical Models Fall 2012
Dummy and Effects Coding of Categorical Predictors
# 40 rats randomized to four treatment groups
# protein source: beef or cereal
# protein amount: low or high
> rats=read.table("./data/weight.tx
R Notes for Applied Linear Statistical Models
James G. Booth Cornell University Fall 2012
Adding a regression line to a scatterplot Scottish hill racing data from Atkinson (1986), Statistical Science 1:397=402 > hills = read.table("./data/hills.txt", sep
R Notes for Applied Linear Statistical Models
James G. Booth Cornell University Fall 2012
Reading data into R Cherry tree data from Atkinson (1982) JRSS B 44:1-36 > cherry = read.table("./data/cherry.txt", sep = ", header = FALSE) > colnames(cherry) = c("
R Notes for Applied Linear Statistical Models
James G. Booth
Cornell University
Fall 2012
Matrix Computations
Basic Matrix Arithmetic
Let a and b denote column vectors of dimension n; that is,
a=
a1
a2
.
.
.
and
b=
b1
b2
.
.
.
bn
an
Transpose: a = (a1 , a
R Notes for Applied Linear Statistical Models
James G. Booth
Cornell University
Fall 2012
Balanced Single Factor Model
Consider the following data from a single factor experiment with 3 replicate
measurements per factor level (batch):
>Y
1
2
3
4
5
6
7
8
9