4 views

Uploaded by weran

goal and objectives

- Track
- January 2005
- grafik geliat mencit3
- How to Maximize Video Views on Youtube
- 41-46
- l2ss3los7q
- Regression and Correlation (1)
- RMppt
- Aug 09
- DCF & Relative Valuation of Reliance Energy
- TUGAS REGRESI
- Comp Assignment d
- Tabel Distribusi T
- alumni giving managerial report rachel whitaker 1
- Inference+for+Regression_CC
- Multiple Regression [Compatibility Mode]
- REGRESI TUBUH COWOK
- Readme
- Correlation and Regression
- Forecast 35

You are on page 1of 26

Simon Wood

Mathematical Sciences, University of Bath, U.K.

i = X i

yi N(i , 2 ).

where i = E (yi ).

g (i ) = Xi

yi EF(i , )

EF(i , ) is any exponential family distribution (e.g. Normal,

gamma, Poisson, binomial, Tweedie, etc. )

is a known or unknown scale parameter

X (= ) is the linear predictor

(log{i /(1 i )}).

g acts a little bit like the data transformations used before

GLMs. However note:

The link function does not transform yi itself.

model, without changing the distribution of the random

variability.

(density) function can be written in a particular general form.

exponential family distributions, then we can write:

var(y ) = V ()

where V is a known variance function of = E(y ), and is

a scale parameter (known or unknown).

knowledge of V , without needing to know the full distribution

of y , using quasi-likelihood theory.

GLMs: scope

example:

distribution.

distribution.

150

100

50

New Cases

200

250

AIDS in Belgium

1982

1984

1986

1988

Year

1990

1992

E(yi ) = N0 e 1 ti

yi Poi

Model is for exponential increase of the expected rate.

Observed number of cases, follows a Poisson distribution.

log (E(yi )) = log(N0 ) + 1 ti

= 0 + 1 ti ,

i.e. a GLM with a log link (0 log(N0 )).

yi Poi

GLM estimation

Model estimation is by maximum likelihood, via a Newton type method. e.g. for the

0.2

0.1

0.0

0.3

0.4

10

20

30

exp(0)

40

50

60

70

IRLS

as an Iteratively Re-weighted Least Squares scheme. . .

Initialize i = g (yi ), then iterate the following steps.

1. Form pseudodata zi = g (

i )(yi

i )/i + i and iterative

weights, wi = i / V (

i )g (

i )2 .

P

2. Minimize the weighted sum of squares i wi (zi Xi )2 w.r.t.

and hence new and .

to obtain a new ,

i = 1 + (yi

i )(Vi /Vi + gi /gi ) gives Newtons method.

likelihood replaces the actual Hessian in Newtons method.

which the Newton Fisher.

At convergence is the MLE (both methods!).

Distribution of

weighted least squares),

N(, (XT WX)1 ).

X

2 /(n dim())

=

wi (zi Xi )

i

Deviance

residual sum of squares of a linear model. This is the deviance.

the : l (). Then the deviance is

D = 2 {l (y) l ()}

for hypothesis testing we need the scaled deviance D = D/.

(When = 1, D = D).

Properties of deviance

If the model exactly fits the data then the deviance is zero.

As a rough approximation

D 2ndim()

if the model is correct. Approximation can be good in some

cases and is exact for the strictly linear model.

= D/{n dim()}.

(Since E (2p ) = p and D = D/.)

Model Comparison

compared using a generalized likelihood ratio test. . .

In terms of the scaled deviance, if model 0 is correct then

D0 D1 2p1 p0 .

2. If is unknown, then the GLRT leads to the approximate

result that, under model 0

(D0 D1 )/(p1 p0 )

Fp1 p0 ,np1 .

D1 /(n p1 )

rather than the simplest model supportable by the data.

For GLMs we need to check the assumptions that the data are

independent and have the assumed mean-variance

relationship, and are consistent with the assumed

distribution.

the mean variance relationship or distribution.

approximately constant variance, and behave something like

residuals for an ordinary linear model.

Pearson residuals

their scaled standard deviation, according to the model

yi

i

pi = p

V (

i )

variability of these residuals should appear to be fairly

constant, when they are plotted against fitted values or

predictors.

Deviance residuals

the squared residuals.

deviances for each datum:

X

D=

di

then by analogy we can view di as a residual.

from a linear model.

glm in R

and the structure of the linear predictor on the right.

referred to by the formula.

model with a log link assuming a Poisson response variable.

belg.aids <- data.frame(cases=c(12,14,33,50,67,74,123,

141,165,204,253,246,240),year=1:13)

am1 <- glm(cases ~ year,data=belg.aids,

family=poisson(link=log))

plot(am1)

13

3.5

4.5

5.5

Predicted values

13

1.5

1.5

Residuals vs Leverage

0.5

1.0

0.5

1

2

0.0 1.0

Theoretical Quantiles

13

0.5

0.5 0.5

2

ScaleLocation

2

0.0

2.0

2

0

Residuals

4 2

Normal QQ

Residuals vs Fitted

Cooks distance

3.5

4.5

5.5

0.0

Predicted values

points.

0.2

Leverage

13

0.4

Try a quadratic time dependence?

am2 <- glm(cases ~ year+I(year^2),data=belg.aids,

family=poisson(link=log))

plot(am2)

ScaleLocation

3.5

4.5

5.5

Predicted values

. . . much better.

1.5

0.0 1.0

Theoretical Quantiles

1.2

0.8

0.4

11

0.5

0.5

13

2.5

3.5

4.5

Predicted values

5.5

Cooks distance

2.5

6

2

0.0

2

1

0

1

1.0

0.0

Residuals

1.5

Residuals vs Leverage

11

11

Normal QQ

11

Residuals vs Fitted

0.0

0.2

0.4

Leverage

0.6

Now, examine the fitted model, first with the default print method

> am2

Call:

glm(formula=cases~year+I(year^2),

family=poisson(link=log),data=belg.aids)

Coefficients:

(Intercept)

1.90146

year

0.55600

I(year^2)

-0.02135

Null Deviance:

872.2

Residual Deviance: 9.24

AIC: 96.92

summary.glm (edited)

> summary(am2)

...

Deviance Residuals:

Min

1Q

-1.45903 -0.64491

Median

0.08927

3Q

0.67117

Max

1.54596

Coefficients:

Estimate Std. Error z value Pr(>|z|)

(Intercept) 1.901459

0.186877 10.175 < 2e-16 ***

year

0.556003

0.045780 12.145 < 2e-16 ***

I(year^2)

-0.021346

0.002659 -8.029 9.82e-16 ***

(Dispersion parameter for poisson family taken to be 1)

Null deviance: 872.2058

Residual deviance:

9.2402

AIC: 96.924

on 12

on 10

degrees of freedom

degrees of freedom

Hypothesis testing

hypothesis that am1 is correct, against the alternative that am2 is

...

> anova(am1,am2,test="Chisq") ## NOT doing ANOVA!

Analysis of Deviance Table

Model 1:

Model 2:

Resid.

1

2

cases ~ year

cases ~ year + I(year^2)

Df Resid. Dev Df Deviance P(>|Chi|)

11

80.686

10

9.240 1

71.446 2.849e-17

> ## NOT doing ANOVA!

Analysis of Deviance Table

Model 1:

Model 2:

Resid.

1

2

cases ~ year + I(year^2) + I(year^3)

Df Resid. Dev Df Deviance P(>|Chi|)

10

9.2402

9

9.0081 1

0.2321

0.6300

AIC comparison

> AIC(am1,am2,am3)

df

AIC

am1 2 166.36982

am2 3 96.92358

am3 4 98.69148

So, both hypothesis testing and AIC agree that the quadratic

model, am2 is the most appropriate.

predict

predictions from a fitted model object.

in a newdata dataframe. If absent the values used for fitting

are employed.

The following predicts from am2, with standard errors.

fv <- predict(am2,newdata=data.frame(year=year),se=TRUE)

Now we can plot the data, fitted curve, and standard error

bands:

plot(belg.aids$year+1980,belg.aids$cases)

lines(year+1980,exp(fv$fit),col=2)

lines(year+1980,exp(fv$fit+2*fv$se),col=3)

lines(year+1980,exp(fv$fit-2*fv$se),col=3)

#

#

#

#

data

fit

upper c.l.

lower c.l.

150

100

50

cases

200

250

1982

1984

1986

1988

year

1990

1992

- TrackUploaded byavitajulianti
- January 2005Uploaded byzmender14
- grafik geliat mencit3Uploaded byarie
- How to Maximize Video Views on YoutubeUploaded byJoao Paulo Moura
- 41-46Uploaded byBAYU
- l2ss3los7qUploaded bykren24
- Regression and Correlation (1)Uploaded byMuhammad Anas Soorty
- RMpptUploaded byRohit Padalkar
- Aug 09Uploaded bytoddcschafer
- DCF & Relative Valuation of Reliance EnergyUploaded bySovit Jaiswal
- TUGAS REGRESIUploaded bySara Delacruz
- Comp Assignment dUploaded bypritish_kul2
- Tabel Distribusi TUploaded byFebri R. Ningrom
- alumni giving managerial report rachel whitaker 1Uploaded byapi-272377609
- Inference+for+Regression_CCUploaded byKelly Alexis Rodriguez
- Multiple Regression [Compatibility Mode]Uploaded bySpandana Achanta
- REGRESI TUBUH COWOKUploaded byUmrotus Syadiyah
- ReadmeUploaded byrkumaravelan4137
- Correlation and RegressionUploaded byRitesh Jain
- Forecast 35Uploaded byDini Ediningtias
- Ssd Count Dia RelationUploaded byPalash
- Auto Clave ExpansionUploaded byDiana Jenkins
- 10.pdfUploaded byRafel Kurnia
- Quantative Methods Final Assesment Test 2.docxUploaded byAnonymous z77xOgW4d
- Sigma - Issues, Insights, And ChallengesUploaded byoscargon19
- Application of a Central Composite Design for the Study OfUploaded byOrlando Yaguas
- Bah Birong.docUploaded byHaruti Hamdani
- DiagnosticsUploaded bycesardako
- Analysis of relationship between road safety and road design parameters of four lane National Highway in IndiaUploaded byIOSRjournal
- DonnaHabib dhabib20@msn com test3Uploaded bydhabib

- Urdu Worksheet 1Uploaded byweran
- Unit 26.pdfUploaded byweran
- Unit 26.pdfUploaded byweran
- Unit 29 PPUploaded byweran
- Unit 27 PPUploaded byweran
- Unit 28 PPUploaded byweran
- Unit 26 PPUploaded byweran
- Unit 25 PPUploaded byweran
- Urdu Homework Class 4Uploaded byweran
- Unit 29.pdfUploaded byweran
- Unit 29.pdfUploaded byweran
- Unit 28Uploaded byweran
- Unit 28Uploaded byweran
- 10-11-10-288cc41Uploaded byweran
- Unit 27Uploaded byweran
- Unit 35Uploaded byweran
- Unit 31Uploaded byweran
- Unit 33 PPUploaded byweran
- Unit 39Uploaded byweran
- Unit 38Uploaded byweran
- Unit 35.pdfUploaded byweran
- Unit 34 PPUploaded byweran
- Unit 37 PPUploaded byweran
- Unit 34Uploaded byweran
- Unit 29.pdfUploaded byweran
- Unit 33Uploaded byweran
- Unit 31 PPUploaded byweran
- Unit 32Uploaded byweran
- Unit 37Uploaded byweran
- Unit 36Uploaded byweran

- Bickel_Mathematical_Statistics_Basic_Ide.pdfUploaded byAkhil Israni
- cims_oct19Uploaded byRichard Ding
- Statistic BookUploaded bykeziavalenni
- hw1Uploaded byBob Sanders
- Bickel, Mathematical Statistics, Basic Ideas and Selected TopicsUploaded byAlex Rodríguez Urbina
- Estimation TheoryUploaded bySenaka Samarasekera
- A Modest Thesis DraftUploaded byJonathan Chang
- 1_M.a.- M. Sc. I Statistics (Dept.)Uploaded byrohit kumar
- apostilaUploaded byMaria Fernanda Ribeiro Dias
- BayesianUploaded bydaselknam
- super-cheatsheet-machine-learning.pdfUploaded bysercharnaud
- Assign 1Uploaded bydarkmanhi
- MARCOULIDES MOUSTAKI-Latent Variable and Latent Structure ModelsUploaded byLuis Huaillapuma
- (Advanced Texts in Physics) Philippe Réfrégier (Auth.)-Noise Theory and Application to Physics_ From Fluctuations to Information-Springer-Verlag New York (2004)Uploaded byJuan Diego Cutipa Loayza
- mgb_3rd_edition_(part_1_-_stat_121_122_-_chap_1_to_4).pdfUploaded byTommy Narrajos
- a1w2017s.pdfUploaded bySarika Uppal
- Stats notesUploaded byKasem Ahmed
- ps1Uploaded byRahul Agarwal
- Jhonson Kotz Dist Discrete Multivariate (1996)Uploaded bygabi_se@
- Statistics 111 Homework 7Uploaded byAC
- IBNR with dependent accident years for Solvency IIUploaded byilyes23SRH
- ML exercisesUploaded byManolis Vlatakis Garagounis
- SolutionsUploaded byFelipe Ruiz
- Cai - Probability Matching Tolerance Intervals for Distributions in Exponential FamiliesUploaded byambrofos
- Lindsey 1997 Applying Generalized Linear Models.pdfUploaded byCarlos Andrade
- College StatisticsUploaded bycaffeine42
- ThesisUploaded byChandan Chouhan
- Handbook of Applied Econometrics & Statistical InferenceUploaded byMarco Tripa Pecena
- solutions2Uploaded byLeo Liang Fang
- unbiased.pdfUploaded bySoundar Pachiappan