Re: [R] How to read the summary

2009-04-29 Thread Prof Brian Ripley

On Tue, 28 Apr 2009, K. Elo wrote:


mathallan wrote:

How can I from the summary function, decide which glm (fit1, fit2 or fit3)
fits to data best? I don't know what to look after, so I would please
explain the important output.


Start with the AIC value (Akaike Information Criterion). The model
having the lowest AIC is the best (of the fitted models, of course).

So, in Your case, the AICs are:


fit1 - glm(Y~X, family=gaussian(link=identity))

AIC: 51.294



fit2 - glm(Y~X, family=gaussian(link=log))

AIC: 32.954



fit3 - glm(Y~X, family=Gamma(link=log))

AIC: 36.65



Hence, the best model seems to be 'fit2'.


Except that fit3 did not use maximum likelihood to estimate the shape 
parameter and so that is not really a valid AIC value (and the actual 
AIC will be smaller since the maximized likelihood will be larger). 
Given that, and that AIC differences between non-nested models are 
highly variable I would see no clearcut difference between fit2 and 
fit3.  (Even for nested models an AIC difference of not more than 3.7 
would not be seen as a large difference.)


This is not really about the subject line at all: 'AIC' as printed 
here is computed by glm() and not summary.glm().  There is a warning 
about it on the ?glm help page (all the 'AIC' values quoted here do 
not take account of the estimation of the dispersion parameter), and 
AIC() does a slightly better job.


--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] How to read the summary

2009-04-28 Thread mathallan

How can I from the summary function, decide which glm (fit1, fit2 or fit3)
fits to data best? I don't know what to look after, so I would please
explain the important output.

 fit1 - glm(Y~X, family=gaussian(link=identity))
 fit2 - glm(Y~X, family=gaussian(link=log))
 fit3 - glm(Y~X, family=Gamma(link=log))
 summary(fit1)

Call:
glm(formula = Y ~ X, family = gaussian(link = identity))

Deviance Residuals: 
Min   1Q   Median   3Q  Max  
-3.6619  -1.9693  -0.4119   2.0787   3.9664  

Coefficients:
Estimate Std. Error t value Pr(|t|)
(Intercept)  -0.4285 1.6213  -0.264 0.798258
X 4.3952 0.7089   6.200 0.000259 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

(Dispersion parameter for gaussian family taken to be 6.784605)

Null deviance: 315.081  on 9  degrees of freedom
Residual deviance:  54.277  on 8  degrees of freedom
AIC: 51.294

Number of Fisher Scoring iterations: 2

 summary(fit2)

Call:
glm(formula = Y ~ X, family = gaussian(link = log))

Deviance Residuals: 
Min   1Q   Median   3Q  Max  
-1.5489  -0.2960   0.4776   0.6353   1.2773  

Coefficients:
Estimate Std. Error t value Pr(|t|)
(Intercept)  0.505370.16562   3.051   0.0158 *  
X0.663520.05083  13.055 1.13e-06 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

(Dispersion parameter for gaussian family taken to be 1.083989)

Null deviance: 315.0810  on 9  degrees of freedom
Residual deviance:   8.6718  on 8  degrees of freedom
AIC: 32.954

Number of Fisher Scoring iterations: 6

 summary(fit3)

Call:
glm(formula = Y ~ X, family = Gamma(link = log))

Deviance Residuals: 
 Min1QMedian3Q   Max  
-0.35269  -0.09272   0.02550   0.13625   0.18018  

Coefficients:
Estimate Std. Error t value Pr(|t|)
(Intercept)  0.859590.11244   7.645 6.04e-05 ***
X0.531340.04916  10.808 4.74e-06 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

(Dispersion parameter for Gamma family taken to be 0.03262828)

Null deviance: 4.31315  on 9  degrees of freedom
Residual deviance: 0.28385  on 8  degrees of freedom
AIC: 36.65

Number of Fisher Scoring iterations: 5
-- 
View this message in context: 
http://www.nabble.com/How-to-read-the-summary-tp23276848p23276848.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to read the summary

2009-04-28 Thread K. Elo
Hi!

mathallan wrote:
 How can I from the summary function, decide which glm (fit1, fit2 or fit3)
 fits to data best? I don't know what to look after, so I would please
 explain the important output.

Start with the AIC value (Akaike Information Criterion). The model
having the lowest AIC is the best (of the fitted models, of course).

So, in Your case, the AICs are:

 fit1 - glm(Y~X, family=gaussian(link=identity))
 AIC: 51.294

 fit2 - glm(Y~X, family=gaussian(link=log))
 AIC: 32.954

 fit3 - glm(Y~X, family=Gamma(link=log))
 AIC: 36.65


Hence, the best model seems to be 'fit2'.

Kind regards,
Kimmo

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.