I'm reading A. Agresti (2007), An Introduction to Categorical Data Analysis, 2nd. edition, and am not sure if I understand this paragraph (p.106, 4.2.1) correctly (although it should be easy):
In Table 3.1 on snoring and heart disease in the previous chapter, 254 subjects reported snoring every night, of whom 30 had heart disease. If the data file has grouped binary data, a line in the data file reports these data as 30 cases of heart disease out of a sample size of 254. If the data file has ungrouped binary data, each line in the data file refers to a separate subject, so 30 lines contain a 1 for heart disease and 224 lines contain a 0 for heart disease. The ML estimates and SE values are the same for either type of data file.
Transforming a set of ungrouped data (1 dependent, 1 independent) would take more then "a line" to include all the information!?
In the following example a (unrealistic!) simple data set is created and a logistic regression model is build.
How would grouped data actually look like (variable tab?)? How could the same model be build using grouped data?
> dat = data.frame(y=c(0,1,0,1,0), x=c(1,1,0,0,0))
> dat
y x
1 0 1
2 1 1
3 0 0
4 1 0
5 0 0
> tab=table(dat)
> tab
x
y 0 1
0 2 1
1 1 1
> mod1=glm(y~x, data=dat, family=binomial())