# [R] Akaike weight in R

Simon Pickett simon.pickett at bto.org
Fri Dec 19 12:43:13 CET 2008

```I'm pretty sure you have to work it out yourself. Here is an example of how
you would tabulate the AIC weights from three models (check that my
calculations are correct before using this yourself!).

Basically model.name\$aic will cut out the AIC values then write a formula to
calculate the weights...

m1<-glm(trantot~unimpgrass+impgrass,family=poisson,data=bbs[bbs\$species==unique(bbs\$species)[1],])
m2<-glm(trantot~marginwidth,family=poisson,data=bbs[bbs\$species==unique(bbs\$species)[1],])
m3<-glm(trantot~impgrass,family=poisson,data=bbs[bbs\$species==unique(bbs\$species)[1],])
aics<-data.frame(paste("m",1:3,sep=""),c(m1\$aic,m2\$aic,m3\$aic),row.names=NULL)
colnames(aics)<-c("model","AIC")
aics<-aics[order(-aics\$AIC),]
for(i in 1:dim(aics)[1]){
aics\$diff[i]<-aics\$AIC[1]-aics\$AIC[i]}
aics\$wi<-2.71828182845904523536^(-0.5*aics\$diff)
aics\$aic.weights<-aics\$wi/sum(aics\$wi)

----- Original Message -----
From: "Odette Gaston" <odette.gaston at gmail.com>
To: <r-help at r-project.org>
Sent: Friday, December 19, 2008 11:26 AM
Subject: [R] Akaike weight in R

> Hi folks,
>
> Wondering how can I generate "Akaike weight" with R? I know the
> description,
> but is there any function to generate by R on the web-site or R library?
> I am using GLM or GLMM (family=binomial), so would be appreciated if you
> help me.
>
> Regards,
> Odette
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help