[R-sig-ME] calculation of AIC

Rolf Turner r.turner at auckland.ac.nz
Sun Feb 1 20:55:59 CET 2009


On 2/02/2009, at 8:41 AM, Adam D. I. Kramer wrote:

>
> On Sun, 1 Feb 2009, orzack wrote:
>
>> Speaking of this, does anybody know how to change the default  
>> rounding for
>> glm (and lmer) OR for an R session in general (e.g., so that a  
>> regular call
>> to glm would generate AIC values with more digits)?
>
>> 1/7
> [1] 0.1428571
>> options(digits=22)
>> 1/7
> [1] 0.1428571428571428
>> options(digits=23)
> Error in options(digits = 23) :
>    invalid 'digits' parameter, allowed 1...22
>> options(digits=22)
>
> ...but this of course won't help if there is explicit rounding  
> programmed
> into glm/lmer. I also do not understand what would motivate this code,
> instead of a more straightforward round(aic,0).

R is open source.  Look at the code (for print.glm()). Or better,  
look at

	args(print.glm)

and you will see that these are ``x'' and ``digits''.

This suggests that

	print(fit,digits=7)

or

	print(fit,digits=17)

(where ``fit'' is the object returned by glm()) may get you somewhere.

You could also simply type ``fit$aic'' to see the AIC printed to  
whatever
number of significant digits your (global) options are set for.

	cheers,

		Rolf Turner

######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}




More information about the R-sig-mixed-models mailing list