APPENDIX
A
Installation
In case you do not already have a LATEX installation, in Sections A.1 and A.2, we
describe how to install LATEX on your computer, a PC or a Mac. The installation is
much easier if you obtain TEX Live 2007 (or later) from the TEX Us
Linear regression
Linear regression is probably the most heavily used piece of
statistical methodology
I
STAT 241 gives a good foundation
We will be looking at how to fit in R
1. How to fit the model and get output
2. Plotting data and model fit
3. Assess
R Basic Plotting
R has near limitless potential for visualising data and fitted
models.
There is quite a learning curve to take advantage of Rs
graphical commands
I
The whole course could be written on it!
We will be getting an introduction
Help available
Optimization
In statistics, we often have the need to optimize a function
I
Maximize it
I
Minimize it
Example: regression
I
Matthew Schofield
How do we find the estimates for intercept and slope?
Slide 1
Optimization
In statistics, we often have the need
Course outline
Statistical computing is becoming increasingly important
We have two clear goals:
1. To become proficient at statistical programming and presenting
of results
2. To study some basic computational statistics techniques.
Lets look at the cour
Data handling in R
To use R for data analysis
I
Matthew Schofield
We need data
Slide 1
R Data Handling
R has several builtin data sets which can be loaded by
calling data(datasetname).
Type data() at the prompt for a list of them.
help(datasetname) gives
R Functions
Goal: you become experts in translating mathematical
functions into (correct!) R code.
I
Already seen many functions built into R
I
Includes algorithms required for statistical inference
e.g. c(.), seq(.), mean(.), etc.
We can also write our o
Loops and conditional statements in R
Considering a couple of very important skills:
1. Loops
for loops
while loops
2. If statements
Matthew Schofield
Slide 1
The if statement in R
In lecture 1 we encountered TRUE and FALSE.
Such a logical variable is k
Simulation and confidence intervals
Follow similar concepts to our last lecture:
I
Use simulation to learn about statistical procedures
Last lecture: sampling distributions
I
Know the value of the parameter
I
Sampling distribution for p is Normal p, p(1p)
Simulation and statistics
Last lecture we considered simulation for probability
calculations
Transition into looking at quantities useful for statistics
Use simulation to learn about:
I
Randomness
I
Estimation
I
Sampling distributions
I
Standard errors
I
Simulation
Over the next four lectures we will use simulation to answer
several probabilistic and statistical questions
I
Also called Monte Carlo method
Idea: use repeated random sampling to obtain numerical
results
I
Very simple idea
I
Look at examples
M
Simulation and power
Continue similar concepts to last two lectures:
I
Done: sampling distributions
I
Done: coverage
Today: power
I
Matthew Schofield
Hypothesis testing
Slide 1
Review: Hypothesis Test
Null hypothesis: H0
Alternative hypothesis: H1
Find th
LATEX and knitr
Today we will be learning about LATEX and knitr
LATEX
I
(pronounced Laytek)
Popular word processor in the sciences
knitr
I
Brings together LATEX and R
I
Used to produce reproducible documents
I
My lectures are written using it
Example fi
CHAPTER
15
Customizing
LATEX
In Section D.1.2, we discuss that Donald E. Knuth designed TEX as a platform on which
convenient work environments could be built. One such work environment, LATEX,
predominates today, and it is indeed convenient.
Nevertheless
Outline
1
Last Lecture
2
Least Squares Estimation
3
Linear Functions of Random Variables
June 16, 2015
1 / 18
Last Lecture
last Lecture
Definition: The model Y = X + where Y is an (n 1) random vector,
X is an n p matrix of known constants, and an (n 1) ra
CHAPTER
11
The AMS article
document class
In this chapter, we discuss amsart, the main AMS document class for journal articles.
The AMS book document class is discussed in Chapter 18.
In Section 11.1, I argue that there are good reasons why you should wri
Outline
1
Last Lecture
2
Linear Model
3
Least Squares
4
Example
5
Matrix Formulation
June 16, 2015
1 / 18
Last Lecture
Last Lecture
Models used by statisticians to depict the process that we believe
generated our data
 Dont have too much faith in the mod
Previous Lectures
I
Hypothesis testing based on a teststatistic that has a known
distribution under H0 .
I
NeymanPearson introduced the idea of alternative hypotheses
I
Assumed that one of H0 or Ha was true
I
NeymanPearson showed that likelihood ratio
STAT 362
Assignment 1, 2015
Due Date: 6pm, Wed 22 July
Answer all questions on a separate document. Please use complete sentences
and type up your answers for all questions. Hand written work will NOT
be accepted.
Q1. Suppose we want to fit a regression l
Last Lecture 1.
I
I
Statisticians use data + model to make inference about
unknown quantities (parameters etc)
Frequentist inference is based on procedures chosen to have
good longrun frequency properties
 Study how the procedures behave under repeated
Models and Data
I
I
Statisticians model data as a device for drawing conclusions
about things that are not observed
Model expressed in terms of parameters
 Numbers that characterize the population in some way
I
Use statistical tools to extract the inform
Last Lecture
I
I
Can readily extend LRT to test a null hypothesis about
restrictions on several parameters simultaneously
Define parameter space .

set of parameter values admissible under H0
 set of admissible values under Ha .
= MLEs of parameters
STAT362 Midterm Test 2015
Q1. Suppose we want to fit a regression line for data y1 , . . . , yn using the
model yi = 0 + 1 xi + 2 x3i + i , where the i s are assumed to have a
zero mean and constant variance 2 .
(a) Find the suitable vectors,Y ,X, and so
Last Lecture 1.
I
If = (1 , . . . , p )0 , the density function for a set of random
variables Y is a member of the exponential family of
distributions if it can be written as
f (y : ) = a()b(y ) exp
k
X
I
j=1
cj ()dj (y )
, k p.
Includes normal, binomial,
STAT 362
Assignment 5, 2015
Due Date: 6pm, Wed 16 September
Answer all questions on a separate document. Please use complete sentences
and type up your answers for all questions. Hand written work will NOT
be accepted.
Q1. Suppose that the joint distribut
STAT 362
Assignment 2, 2015
Due Date: 6pm, Wed 5 August
Answer all questions on a separate document. Please use complete sentences
and type up your answers for all questions. Hand written work will NOT
be accepted.
Q1. In an experiment to investigate the
STAT362 Midterm Test 2014
Q1 Suppose we want to fit a regression line that is cubic in x and forced
through the origin for data y1 , . . . , yn using the model yi = x3i + i ,
where the i are all assumed to have a zero mean.
(a) Find the leastsquares esti
Last Lecture
Theorem 19.1
I
If Y has probability (density) function fY (y ; ),
I
If the regularity conditions hold,
h
i
2 with 1 df
Under H0 : = 0 T = 2 lnL(0 ) ln L()
in large samples,
I
 is the MLE of
I
Provided we have a large sample, we can always