Hi,
Just thought I'd try to send this on here, maybe anyone has suggestions on how to solve this. I have encountered a problem, I created a program to simulate bootstrapped samples from a mixed regression and some healthcare costs, to get one of those cost-effectiveness planes with the bootstrapped "cloud". However, the simulation works only for the first 21 repetitions.
I have searched a lot for any potential similar posts (here and google etc), but I think if there are any these stay "hidden" cause I found no great combination of words to use in the search, end up with a lot of other stuff.
As you can see from the code, I try to do all the bootstrap simulations in one go, both costs (variable: totalcost) and health-related quality of life (HRQoL, variable: EQ5Dscore_). 'totalcost' is what it sounds like, a total cost, the same in all rows so to ensure I do not use multiple rows for each person in the dataset I have selected to only use the totalcost for the row indicating time==1. However, this is panel data, so HRQoL was measured at multiple timepoints for each patient, and therefore I want to use a longitudinal mixed model for the QALY-estimation.
From that, the simulations start running (very slowly, as it should), but after the first 21 repetitions it speeds up and just give me those red x's indication failed repetition. This problem has occurred both when doing only 30 repetitions and when doing the full set of 1000 repetitions:
Simulations (1,000)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
.....................xxxxxxxxxxxxxxxxxxxxxxxxxxxxx 50
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 100
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 150
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 200
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 250
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 300
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 350
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 400
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 450
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 500
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 550
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 600
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 650
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 700
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 750
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 800
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 850
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 900
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 950
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1,000
A colleague who tried to use a simular code (we developed it together, so very similar code but completely other dataset) had the exact same issue.
Have anyone tried to do something similar or had a similar problem turn up with simulations/bsample? Can you see from what I post here already what is the issue, maybe?
Of course also super thankful for any other comments/suggestions/guidance to improve the code or my set up for this analysis.
Kind regards,
Hanna
Just thought I'd try to send this on here, maybe anyone has suggestions on how to solve this. I have encountered a problem, I created a program to simulate bootstrapped samples from a mixed regression and some healthcare costs, to get one of those cost-effectiveness planes with the bootstrapped "cloud". However, the simulation works only for the first 21 repetitions.
I have searched a lot for any potential similar posts (here and google etc), but I think if there are any these stay "hidden" cause I found no great combination of words to use in the search, end up with a lot of other stuff.
Code:
preserve capture program drop twomeans program define twomeans, rclass bsample qui mixed EQ5Dscore_ time##i.Intervention || lopnr: time, cov(un) margins Intervention, at(time=(0 1 2 6 12 24)) vsquish predict() post matrix list e(b) matrix alpha = e(b) return scalar G1T0=alpha[1,1] return scalar G1T1=alpha[1,3] return scalar G1T2=alpha[1,5] return scalar G1T6=alpha[1,7] return scalar G1T12=alpha[1,9] return scalar G1T24=alpha[1,11] return scalar G2T0=alpha[1,2] return scalar G2T1=alpha[1,4] return scalar G2T2=alpha[1,6] return scalar G2T6=alpha[1,8] return scalar G2T12=alpha[1,10] return scalar G2T24=alpha[1,12] qui regress totalcost i.Intervention if time==1 matrix list e(b) matrix beta = e(b) return scalar G2=beta[1,2] return scalar constant=beta[1,3] exit end simulate diff=r(G2) constant=r(constant) G1T0=r(G1T0) G1T1=r(G1T1) G1T2=r(G1T2) G1T6=r(G1T6) G1T12=r(G1T12) G1T24=r(G1T24) G2T0=r(G2T0) G2T1=r(G2T1) G2T2=r(G2T2) G2T6=r(G2T6) G2T12=r(G2T12) G2T24=r(G2T24), reps(1000) seed(5678) saving(Manuscript - Adherence PAK\Analyses\Temp\cloud_all_uk.dta, replace): twomeans
From that, the simulations start running (very slowly, as it should), but after the first 21 repetitions it speeds up and just give me those red x's indication failed repetition. This problem has occurred both when doing only 30 repetitions and when doing the full set of 1000 repetitions:
Simulations (1,000)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
.....................xxxxxxxxxxxxxxxxxxxxxxxxxxxxx 50
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 100
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 150
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 200
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 250
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 300
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 350
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 400
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 450
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 500
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 550
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 600
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 650
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 700
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 750
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 800
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 850
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 900
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 950
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1,000
A colleague who tried to use a simular code (we developed it together, so very similar code but completely other dataset) had the exact same issue.
Have anyone tried to do something similar or had a similar problem turn up with simulations/bsample? Can you see from what I post here already what is the issue, maybe?
Of course also super thankful for any other comments/suggestions/guidance to improve the code or my set up for this analysis.
Kind regards,
Hanna
Comment