I am trying to fit a survival analysis in R
with non-recurrent events and time-varying coefficients. The baseline distribution is exponential or Weibull and the frailty distribution is gamma distributed. I have roughly 900.000 rows.
So far I have tried the parfm
and frailtypack
. Though, neither has worked – they just keep running and never return. The calls for parfm
and frailtypack
are similar to respectively:
frailtyPenal(Surv(stop-start,event)~.-start-stop-event-year+cluster(temp$year),
data= regressionData, hazard="Weibull", RandDist=”Gamma”)
parfm(Surv(stop-start,event)~.-start-stop-event-year,cluster=”year”,
regressionData, dist="exponential", frailty = "gamma")
Where event
is zero-one coded. My guess so far is to use the lme4
package with the function glmer
where the family is Poisson, the respond are zero-one coded, the offset is the difference in time and random effect is an intercept for the year factor. I.e. something like:
glmer(event ~.-start-stop-event-year+(1|year), family = Poisson(), offset=stop-start)
I know that this will yield Gaussian distributed random effects and not Gamma. Further, I am not sure that I get the model I want. My goal is to have exponential distributed conditional waiting times and hence I chose the Poisson distribution. Question is whether this is correct? Any suggestions on other packages that will do the job?