Skip to content
Prev 79980 / 398502 Next

GLM

Dear Jeff,

One way to do this is with by():

summaries <- by(example, Individual, function(data){ 
    mod <- glm(Type~Dwater+Habitat, data=data, family=binomial)
    list(AIC=AIC(mod), coef=coef(mod))
    })
    
sapply(summaries, function(x) x$coef)
rowMeans(sapply(summaries, function(x) x$coef))
sapply(summaries, function(x) x$AIC)

I hope this helps,
 John

--------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox 
--------------------------------