It has always been my understanding that deviance for GLMs is defined
by;

 

D =  -2(loglikelihood(model) - loglikelihood(saturated model))

 

and this can be calculated by (or at least usually is);

 

D = -2(loglikelihood(model))

 

As is done so in the code for 'polr' by Brian Ripley (in the package
'MASS') where the -loglikehood is minimised using optim;

 

res <- optim(s0, fmin, gmin, method = "BFGS", hessian = Hess, ...)

.

.

.

deviance <- 2 * res$value

 

If so, why is it that;

 

> x = rnorm(10)

> y = rpois(10,lam=exp(1 + 2*x))

> test = glm(formula = y ~ x, family = poisson)

> deviance(test)

[1] 5.483484

> -2*logLik(test)

[1] 36.86335

 

I'm clearly not understanding something here, can anyone shed any light?
Why is;

 

-2*logLik(test) =/= deviance(test) ???

 

I think this is something that is poorly understood all over the
internet (at least from my google searches anyway!)

 

Thanks,

 

Jeff

 

----------------------------------------- ********************************************** Confidentiality: The contents of this e-mail and any attachments transmitted with it are intended to be confidential to the intended recipient; and may be privileged or otherwise protected from disclosure. If you are not an intended recipient of this e-mail, do not duplicate or redistribute it by any means. Please delete it and any attachments and notify the sender that you have received it in error. This e-mail is sent by a William Hill PLC group company. The William Hill group companies include, among others, William Hill PLC (registered number 4212563), William Hill Organization Limited (registered number 278208), William Hill Credit Limited (registered number 413846), WHG (International) Limited (registered number 99191) and WHG Trading Limited (registered number 101439). Each of William Hill PLC, William Hill Organization Limited and William Hill Credit Limited is registered in England and Wales and has its registered office at Greenside House, 50 Station Road, Wood Green, London N22 7TP. Each of WHG (International) Limited and WHG Trading Limited is registered in Gibraltar and has its registered office at 6/1 Waterport Place, Gibraltar. Unless specifically indicated otherwise, the contents of this e-mail are subject to contract; and are not an official statement, and do not necessarily represent the views, of William Hill PLC, its subsidiaries or affiliated companies. Please note that neither William Hill PLC, nor its subsidiaries and affiliated companies can accept any responsibility for any viruses contained within this e-mail and it is your responsibility to scan any emails and their attachments. William Hill PLC, its subsidiaries and affiliated companies may monitor e-mail traffic data and also the content of e-mails for effective operation of the e-mail system, or for security, purposes. *********************************************

	[[alternative HTML version deleted]]

