Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Random effects/frailty models? #185

Open
casasgomezuribarri opened this issue Apr 2, 2024 · 3 comments
Open

Random effects/frailty models? #185

casasgomezuribarri opened this issue Apr 2, 2024 · 3 comments

Comments

@casasgomezuribarri
Copy link

casasgomezuribarri commented Apr 2, 2024

From the vignette:

flexsurv does not currently support shared frailty, clustered or random effects models.

Is there any workaround for this? I am working with a highly heterogeneous system, so my experiments have several technical replicates. I was using cluster() in the formula argument of my flexsurvreg model thinking it would do the job, but replicate is being treated as a main effect (significant...)

I want to account for the variation across replicates in my model, but I don't want to treat it as a main effect. Is there anything I can do?

@chjackson
Copy link
Owner

There's no technique in flexsurv to do random effects that I know of. There is other software that would support this class of model e.g. frailtypack in R, or Bayesian software such as Stan (e.g. starting from https://mc-stan.org/docs/2_18/stan-users-guide/censored-data.html to represent censoring, then building up your model piece by piece in Stan code).

Is your goal to adjust the variance of some estimate of interest to account for clustering? And your mention of cluster suggests you have tried survreg or coxph, but would prefer to use flexsurvreg? Then perhaps you could do something like this:

  • Estimate a "variance inflation factor" by fitting models fitted by survreg with and without clustering terms, and calculating how much the variance increases when you account for clustering.

  • Fit your more flexible model in flexsurvreg, then multiply the variance of your estimate of interest by this inflation factor.

This would assume that the amount of variance inflation is independent of the baseline distribution. I'd expect this is a weak assumption, though I don't have practical experience with doing this.

@casasgomezuribarri
Copy link
Author

Thanks for your suggestions, I'll explore them in detail.

For a bit of context:
I prefer flexsurvreg because of the wider distribution options and the possibility of fitting parameters other than the location parameter. I want to use the gengamma distribution, and I want to explore the effect of my covariates on all three parameters, but clustering should not be overlooked for my system.

Can survreg fit ancillary parameters like flexsurvreg? In that case, I could try to parse the gengamma as a survreg.distributions-type list (see https://www.rdocumentation.org/packages/survival/versions/3.5-7/topics/survreg.distributions). Would that make sense?

I'll continue to explore my possibilities. Thanks again

@chjackson
Copy link
Owner

I'm not aware of any way of placing covariates on ancillary parameters in survreg, but it's not my package. Also I think the "location/scale" setup that survreg uses would be restricted to two-parameter distributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants