Stat 431/831
ASSIGNMENT 1
Due: September 27, 2012
Reminder: Your assignment must be handed in by 1:00pm on the due date in MC 4045.
Note: Be sure to include all R code and relevant output for all questions of this assignment.
1. The following data are the
Stat 431/831
ASSIGNMENT 1 SOLUTIONS
1. Recall that you were given the likelihood:
n
f (ti ; )i [1 F (ti ; )](1i )
L(; t, ) =
i=1
(a) Since the Ti are exponentially distributed we know that the pdf and cdf are given by:
f (t; ) = exp(ti )
1 F (t, ) = P [Ti
Stat 431
Winter 2011
Assignment 1
Assignment due at 10:30 a.m., Friday January 21.
1. Consider a 2 2 contingency table from a prospective study in which people who
were or were not exposed to some pollutant are followed-up and, after several years,
catego
Stat 431/831
ASSIGNMENT 2 SOLUTIONS
1. Let Yk Bin(mk , k ) iid k = 1, 2 and xk = I [k = 1]. Consider the logistic regression model
log(k /(1 k ) = 0 + 1 xk
(a) The likelihood in terms of (1 , 2 ) is given by:
y
y
L(1 , < 2) 1 1 (1 1 )(m1 y1 ) 2 2 (1 2 )(m
STAT 431
ASSIGNMENT 1
DUE: Wed, January 25, 2012, AT 10:30 AM
1. (a) The likelihood is
n
n
L() = (2 2 ) 2 exp
(yi )2 /2 2 .
i=1
The log likelihood is
n
n
() = log (2 2 ) (yi )2 /2 2 .
2
i=1
(b) The score function is
n
(yi )/ 2 = n( )/ 2 .
y
S () =
i=1
Th
Stat 431/831
ASSIGNMENT 1
Due: September 30, 2010
1. Consider a series of Bernoulli random variables where the probability of success for each trial
is and the probability of failure is 1 . The random variable Y , which represents the
number of failures b
Stat 431/831
ASSIGNMENT 2
Due: October 11, 2012
Reminder: Your assignment must be handed in by 1:00pm on the due date in MC 4045.
Note: Be sure to include all R code and relevant output for all questions of this assignment.
1. Wilson and Mandelbrote (1978
Stat 431/831
MIDTERM SOLUTIONS
1. 431 Version
(a) [2 marks] The likelihood for the rate functions = (1 , . . . , n )T is
n
(i tij )yij ei tij
yij !
i=1
L() =
(b) [6 marks] Recall that Yi P OI (i ti ). The likelihood for Yi is thus
(i ti )yi ei ti
yi !
= e
Stat 431/831
ASSIGNMENT 2
Due: October 14, 2010
Note: Be sure to include all R code and relevant output for questions 2-4 of this assignment.
1. Suppose Yk Bin(mk , k ), k = 1, 2 are two independent binomial random variables. Let xk
denote an explanatory
Stat 431/831
ASSIGNMENT 3
Due: November 1, 2012
Reminder: Your assignment must be handed in by 1:00pm on the due date in MC 4045.
Note: Be sure to include all R code and relevant output for all questions of this assignment. Be
kind to your TA, dont make t
Stat 431/831
ASSIGNMENT 3 SOLUTIONS
1. (a) It seems reasonable to assume that the number of claims Yl observed on a singly policy
has a poisson distribution with mean l and that policies are independent. Since the data
is aggregated over age/volume/distri
1
STAT 431
ASSIGNMENT 2
DUE: Monday, February 13, 2012, AT 10:30 AM
QUESTION 1
(a) We start our investigation by tting the main eects model, that is, the model with only TNF
(denoted by x1 ) and IFN (denoted by x2 ) doses included, and the model that incl
Stat 431/831
ASSIGNMENT 4
Due: November 22, 2012
Reminder: Your assignment must be handed in by 1:00pm on the due date in MC 4045.
Note: Be sure to include all R code and relevant output for all questions of this assignment. Feel
free to print you output
Stat 431/831
TERM TEST 2 SOLUTIONS
Question 1
[20/25 marks]
(a) Here we are modelling the death counts (ij ) in various age and smoking groups: [4 marks]
log(ij ) = log(ij ij ) = log ij + log ij = x + log(ij )
It is important to include the oset term beca
1
A Brief Review of Likelihood Methods
Problem 1.1.
Suppose that Yi , i = 1, . . . , n, are independent and identically distributed
normal random variables with unknown mean and known variance 2 . The
probability density function of each Y is then given b
STAT 431
ASSIGNMENT 2
DUE: Monday, February 13, 2012, AT 10:30 AM
1. In a biomedical study of an immuno-activating ability of two agents TNF (tumor necrosis
factor) and IFN (interferon), to induce cell dierentiation, the number of cells that exhibit
marke
Stat 431/831
ASSIGNMENT 1 SOLUTIONS
1. (a) For Y1 , Y2 , . . . , Yn iid with the geometric distribution we have
P (Yi = yi ; ) = (1 )yi
0 < < 1, yi = 0, 1, . . .
The likelihood function is
n
(1 )yi
L( ; y ) =
i=1
= (1 )
n
i=1
yi
n
The loglikelihood func
STAT 431
SKETCH SOLUTIONS OF TERM EXAM 1
FEBRUARY 1, 2012
1. (a) Recall that in the case of a continuous random variable y :
f (y ; , )dy = 1
f (y ; , )dy =
1
f (y ; )dy = 0
assuming we can bring the dierential operator inside the integral. Since
1
log f
Stat 431/831
Assignment 3
Due: 12pm November 1st, 2013
Note: Use cover page. Include all R code and relevant output. At the same time, you should
properly organize/summarize your results; we are not supposed to search for your results in R
output.
1. In a
Stat 431/831
ASSIGNMENT 2 SOLUTIONS
1. (a) Using the raw data we estimate the odds ratio of having a conviction for someone with
a long education versus someone with a short education to be 0.4167.
6
L = P [conviction|long education] =
24
16
S = P [convic
Contingency Tables
Matthias Schonlau, Ph.D.
Overview
Example 2-way contingency table: Malanoma
Mosaic plots to detect interactions
Omitting different categories
Example: Calculating Deviance residuals
Melanoma Study
Cross section study with a fixed numbe
3-way contingency tables
Matthias Schonlau, Ph.D.
Overview
Mutual / Conditional / Joint independence
Goodness of fit
Example : Seatbelts
3-way tables
In a two way table we had two categorical
variables
one two-way interaction
In a 3-way table we hav
Negative Binomial Regression
Matthias Schonlau, Ph.D.
Negative Binomial
Instead of an ad-hoc solution, we now
consider a parametric model that addresses
overdispersion for Poisson regression.
Negative Binomial
Solution to overdispersion: add a parameter
Quasi Likelihood
Matthias Schonlau, Ph.D.
Quasi Likelihood
GLMs require specification of three
components:
random component (distribution)
systematic component (linear function)
link function
Estimate beta via maximum likelihood
Set the first deriva
Overdispersion
Matthias Schonlau, Ph.D.
Overview
Overdispersion
Ad Hoc method for Overdispersion
Overdispersion
In most Poisson regression applications the
variance is greater than would be predicted by
the model.
This is called overdispersion.
Overdi
Random Effects for binary
models
Matthias Schonlau, Ph.D.
Overview
Random effects (for binary outcomes)
Transition models
Example: Waterloo smoking study
GEE and alternatives
GEE models are semi-parametric
They do not require a fully specified probab
Generalized Estimating Equations
(GEE)
Matthias Schonlau, Ph.D.
Clustering
In GLM we have always assumed observations
are independent
Examples of clusters include
patients within hospitals
students within schools
children within families
repeated measur
Question [12 marks] Fabric.
Consider a simple study conducted to examine the rate at which faults" appear in rolls of
fabric. Here the faults" are imperfections, which means that it is not possible to sell the
affected portion of fabric. Data are provided
Poisson Regression
Matthias Schonlau, Ph.D.
Overview
Cargo Ship example
LR tests of multiple vars
Interpretation/ Relative Rates
CIs of contrasts
Estimation
Ship Damage Incidents
Number of times a certain damage incident
occurs in cargo ships
y: #
Parameter Estimation for GLMs
Matthias Schonlau, Ph.D.
Overview
Iterative reweighted least squares (IRLS)
Mosaic Plots (not in course notes)
Optimization
The maximum likelihood estimator cannot
usually be obtained in closed form
numerical optimization
Contingency Tables
Matthias Schonlau, Ph.D.
Overview
Two-way tables
Multinomial
Product Multinomial
Poisson
2-way Tables
.
2-way Tables - Multinomial
Assume cell frequencies have independent
Poisson distribution.
Show that by conditioning on the gra
Generalized Estimating Equations
(GEE)
Matthias Schonlau, Ph.D.
Overview
Waterloo Smoking Example
Robust Standard Errors
Waterloo Smoking
Example
Data give smoking status
(yes/no) on 439
individuals in two school
boards (Waterloo and
Oxford) across 22