Closed frbrz closed 3 years ago
Thank you for reporting this; I will look into it further in the next coming days.
If you are interested in maintaining the covariates in the proper order, I suggest merging them to the event data-set. If I get a chance I will provide an example for that as well.
Hi Matthew,
Thanks for your reply and looking at this so quickly.
Well for sim.id == 1 and id == 1 it is 70.21961
Indeed you are right about this and as you suggest I could merge with the original dataset to get the original ids.
However I think that there may be something wrong with the id /sim.id columns and their relationship with keep. Using the code you have sent me (with WT2) if you restrict the simulation results to sim.id == 1 you get the following WT2:
as.data.frame(sim) %>% filter(sim.id == 1) %>% count(WT2) WT2 n 1 54.58081 50 2 60.63536 50 3 70.21961 50 4 74.27097 50 5 74.66919 50 6 76.10526 50 7 76.74155 50 8 80.28497 50 9 82.59484 50 10 83.09933 50
I am not sure I understand correctly the difference between WT and WT2 as in they have exactly the same values. See below: all(sim$WT == sim$WT2) TRUE
Only 10 different WT2s are generated for sim.id == 1 (and all other sim.ids), given that I specified nSub = 100, I would expect to see 100 different WT2, each with n = 5 (irrespective of the id label). What is interesting is that when I look at the id for sim.id == 1 I have exactly 100 of them (expected behaviour). So I believe that there is something wrong with the way baseline covariates are linked to id.
as.data.frame(sim) %>% filter(sim.id == 1) %>% count(id) id n 1 1 5 2 2 5 3 3 5 4 4 5 5 5 5 6 6 5 7 7 5 8 8 5 9 9 5 10 10 5 11 11 5 12 12 5 13 13 5 14 14 5 15 15 5 16 16 5 17 17 5 18 18 5 19 19 5 20 20 5 21 21 5 22 22 5 23 23 5 24 24 5 25 25 5 26 26 5 27 27 5 28 28 5 29 29 5 30 30 5 31 31 5 32 32 5 33 33 5 34 34 5 35 35 5 36 36 5 37 37 5 38 38 5 39 39 5 40 40 5 41 41 5 42 42 5 43 43 5 44 44 5 45 45 5 46 46 5 47 47 5 48 48 5 49 49 5 50 50 5 51 51 5 52 52 5 53 53 5 54 54 5 55 55 5 56 56 5 57 57 5 58 58 5 59 59 5 60 60 5 61 61 5 62 62 5 63 63 5 64 64 5 65 65 5 66 66 5 67 67 5 68 68 5 69 69 5 70 70 5 71 71 5 72 72 5 73 73 5 74 74 5 75 75 5 76 76 5 77 77 5 78 78 5 79 79 5 80 80 5 81 81 5 82 82 5 83 83 5 84 84 5 85 85 5 86 86 5 87 87 5 88 88 5 89 89 5 90 90 5 91 91 5 92 92 5 93 93 5 94 94 5 95 95 5 96 96 5 97 97 5 98 98 5 99 99 5 100 100 5
Thanks again for your help, best Francesco
On Wed, Apr 21, 2021 at 6:50 AM Matthew Fidler @.***> wrote:
In your comments you said:
Error? For id == 1 I would have expected to have WT equal to wt[1] (i.e. 70.21961)
Well for sim.id == 1 and id == 1 it is 70.21961
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nlmixrdevelopment/RxODE/issues/408#issuecomment-823773482, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATYNZ6A44KPM3XO5EJGSXTLTJZKQ3ANCNFSM43IO44AA .
I changed the iCov
as an easy way to merge the individual covariates to the input dataset. It simplifies the code.
While it does something a bit different from the original intent, I think that simulation with uncertainty by resampling the original covariates by resample=TRUE
is a bit better than what the original intent of how iCov
was made to work.
I updated the vignette to show the simulation that you discuss here; Once updated it will show the new iCov
behavior here:
Let me know if this new behavior makes sense to you.
I had a look at the updated vignette commit and it does make sense to me. Next week I will upgrade to the development version and can test the patch.
Thanks again for the speedy fix!
Hi,
Thanks for this great package.
I am using RxODE to simulate a population with uncertainty in their population parameters. I am interested in the scenario where baseline covariates are fixed across simulations and I am getting some strange results, as covariates do not appear to remain constant for the same
id
in differentsim.id
.I have attached a minimal reproducible example, based on the simulation article (
https://nlmixrdevelopment.github.io/RxODE/articles/RxODE-sim-var.html#simulation-from-inverse-wishart-correlations-1
).Side note: I think I noticed a typo on the webpage. In the Rx1 model,
cl
is defined as:cl <- tcl*(1+crcl.cl*(CLCR-65)) * exp(eta.v)
shouldeta.v
be replaced byeta.cl
?Back to the problem: I want to simulate 100 individuals, 10 times with the same covariates. I am using the
iCov
argument in thesolve
function. I have tried three different approaches, which I believe should give the same results (see code below for more details):'nSub'*'nStud' does not match the number of subjects in 'iCov'
.Am I missing something or is this a bug?
Many thanks for the help!
Created on 2021-04-20 by the reprex package (v0.3.0)