Open seabbs opened 3 weeks ago
Thanks for your comment, but we are not clear about the nature of the problem. Could you provide us a runnable example so that we could really understand it ? Or if it is not possible, try to give us more details in the description of the problem ? Best regards, Marie Laure
Sure.
This is our current wrapper function: https://github.com/epinowcast/primarycensoreddist/blob/main/R/fitdistdoublecens.R
Note the need to use withr
to dummy the global environment which has been our fix to get around this for our use case.
This is an example use case: https://github.com/epinowcast/primarycensoreddist/blob/main/R/fitdistdoublecens.R
The first example shows how to naively use fitdistrplus
directly for this problem, the second shows a manual approach which I think is your recommended approach and the last shows our function wrapper approach.
The core of the problem is the design choice to rely on detecting distribution functions in the global environment as this makes extending the package difficult because you have to assign your custom distributions to the global environment. I see a few options:
withr
) or a better solution if available (I don't know what this would be but perhaps we are misunderstanding). withr
and make everything "just work".Happy to implement any of these as a PR.
Firstly, thanks for a great package.
We are currently extending
fitdistrplus
to support primary censored events (on top of your existing support for secondary censoring) and have got a bit stuck with the custom distribution support. The issue we are facing is assigning a custom distribution to the global environment to make it work. This works which is great but I think it won't be CRAN compliant - see https://github.com/epinowcast/primarycensoreddist/issues/62v.Is there anything we have missed with
fitdistrplus
that might help us or any other suggestion to work around this?If the answer to both of those is no then potentially this could be resolved by allowing custom family functions to be passed as arguments. If you are interested in that I would be happy to submit a PR.