[R] GLM

Jeff Row jeffrow51 at hotmail.com
Mon Oct 31 18:01:12 CET 2005


Hello R-users,

I am a relatively new user of R and I have a question regarding glm. I want 
to run the function GLM on multiple individuals separately and then get 
means for summary statistics such as AIC and coef. Is there a way to do this 
in R without separately going through each individual and subsetting the 
dataset, getting the summary statistics and averaging them? For example, in 
the dataset below I would like to run the function:

>glm(Type~Dwater+Habitat, data=example, family=binomial())

on each individual separately and then get the average for the coef's Dwater 
and Habitat for the 3 individuals.

>example
   Individual Type Dwater Habitat
1           1    0     40       0
2           1    1     80       1
3           1    0     30       0
4           1    1     90       0
5           2    0     15       1
6           2    1     95       1
7           2    0     20       0
8           2    1     75       1
9           3    0     15       0
10          3    1     60       1
11          3    0     10       1
12          3    1     95       0

Thanks,

Jeff.




More information about the R-help mailing list