Open casasgomezuribarri opened 3 months ago
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.
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
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.
From the vignette:
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 theformula
argument of myflexsurvreg
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?