Dear R-Users,
without going into details I tried to prepare a simple example to show
you where I would need help.
In particular I prepare two examples-template for a study I'm conduction
on discrete-time methods for survival analysis.
Each of this example has two datasets which are basically equal, with
the exception that in the former one has individual data and in the
latter one aggregated data.
The difference between the two examples is on a single subject: I
substituted to the first example a censored case with a subject who died
at the first time-unit.
Afterward I fitted a logistic model (Fahrmeir and Tutz, 2001) in the glm
context, but whereas there is not difference between individual and
aggregated dataset in the first example, I noted some discrepancies in
the second example. I might guess that something with weights is going
on, but I did not manage to clearly understand.
Hope that the following example will be more clear than my explanations,
Thanks in advance,
Carlo Giovanni Camarda


rm(list = ls())
# working one

timesIND  <- c(rep(1:4, 3), 1, rep(1:2,2), rep(1:3     , 2), rep(1:4,
2))
statusIND <- c(rep(0  ,12), 1, rep(0:1,2), rep(c(0,0,1), 2),
rep(c(0,0,0,1),2))
datiIND <- as.data.frame(cbind(timesIND, statusIND))
datiIND$timesIND <- as.factor(datiIND$timesIND)

timesAGG  <- c(  1:4,    1,   1:2,      1:3,       1:4)
statusAGG <- c(rep(0,4), 1,   0:1,    c(0,0,1), c(0,0,0,1))
weightAGG <- c(rep(3,4), 1, rep(2,2), rep(2,3), rep(2,4))   
datiAGG <- as.data.frame(cbind(timesAGG, statusAGG, weightAGG))
datiAGG$timesAGG <- as.factor(datiAGG$timesAGG)

coef(glm(statusIND ~ timesIND, family=binomial, data=datiIND))
coef(glm(statusAGG ~ timesAGG, family=binomial, data=datiAGG,
weights=weightAGG))

# not working one

timesINDa  <- c(rep(1:4, 4), rep(1:2,2), rep(1:3     , 2), rep(1:4,
2))
statusINDa <- c(rep(0  ,16), rep(0:1,2), rep(c(0,0,1), 2),
rep(c(0,0,0,1),2))
datiINDa <- as.data.frame(cbind(timesINDa, statusINDa))
datiINDa$timesINDa <- as.factor(datiINDa$timesINDa)

timesAGGa  <- c( 1:4,        1:2,     1:3,      1:4)
statusAGGa <- c(rep(0,4),    0:1,   c(0,0,1), c(0,0,0,1))
weightAGGa <- c(rep(4,4), rep(2,2), rep(2,3),  rep(2,4))   
datiAGGa <- as.data.frame(cbind(timesAGGa, statusAGGa, weightAGGa))
datiAGGa$timesAGGa <- as.factor(datiAGGa$timesAGGa)

coef(glm(statusINDa ~ timesINDa, family=binomial, data=datiINDa))
coef(glm(statusAGGa ~ timesAGGa, family=binomial, data=datiAGGa,
weights=weightAGGa))

+++++
This mail has been sent through the MPI for Demographic Rese...{{dropped}}


