Pmetrics icon indicating copy to clipboard operation
Pmetrics copied to clipboard

Bootstrap?

Open roninsightrx opened this issue 2 years ago • 6 comments

Is there bootstrap functionality available in Pmetrics? I see reference to a bootstrap argument in makeDen() but otherwise no mention.

roninsightrx avatar May 09 '23 17:05 roninsightrx

Not currently, no, but we are always willing to add function!

mnneely avatar May 09 '23 17:05 mnneely

No problem, I'll see if I can write something myself. Will share code.

roninsightrx avatar May 09 '23 17:05 roninsightrx

Thanks. You are welcome to fork if that helps. We are happy to help/advise too. It's a worthwhile addition.

mnneely avatar May 09 '23 17:05 mnneely

Sure, I had a few other minor suggestions to the package too, will fork and make a PR.

W.r.t. bootstrap, I was thinking to just bootstrap the posterior means for the individuals after fitting, and recompute the statistic of interest (population mean) for each bootstrap sample. Or do you think it's more appropriate to bootstrap the original dataset and rerun all model fits on each bootstrap sample, and then compute the mean over the resulting fits? I've used both approaches in the past and usually they gave very similar results. But that was in a different context, and with parametric models, not sure what would be appropriate for the NP approach... Of course the former approach is much faster.

roninsightrx avatar May 09 '23 18:05 roninsightrx

But I guess when there are fixed parameters the only option is to do the latter, i.e. resample on the original dataset and fit repeatedly.

roninsightrx avatar May 09 '23 22:05 roninsightrx

Approach #1 sounds similar to the bootstrap method we use to estimate a credibility interval around the median population parameter values. You can see it described in ?summary.PMfinal in R. We don’t calculate the population mean from the means of the posteriors, but I think they should be fairly similar, as I do know that the combined distribution of the posteriors over the population reproduces the distribution of the non-parametric discrete support points (the prior). So if I understand your #1 correctly, I think that would be viable. We’d have to test it. Yes, if you wanted a CI around a fixed parameter, I think the only way would be to re-run the model on subsets of the data with replacement, which could get very slow. But let me ponder that with the group.

mnneely avatar May 10 '23 13:05 mnneely