NM: subproblem dependent on Y can't allow me to assign value from a previous time to a current one #1034
Unanswered
AMCasablancas
asked this question in
Q&A
Replies: 1 comment
-
Hi @AMCasablancas - is this what you are looking for? library(mrgsolve)
#>
#> Attaching package: 'mrgsolve'
#> The following object is masked from 'package:stats':
#>
#> filter
code <- '
$PARAM CL = 5, V = 10
$PKMODEL cmt = "CENT"
$TABLE
if(NEWIND <=1) double PREV = 0;
capture Y = CENT/V;
capture YPREV = PREV;
PREV = Y;
'
mod <- mcode("prev", code)
#> Building prev ...
#> done.
mrgsim(mod, events = ev(amt = 100))
#> Model: prev
#> Dim: 26 x 5
#> Time: 0 to 24
#> ID: 1
#> ID time CENT Y YPREV
#> 1: 1 0 0.000 0.0000 0.0000
#> 2: 1 0 100.000 10.0000 0.0000
#> 3: 1 1 60.653 6.0653 10.0000
#> 4: 1 2 36.788 3.6788 6.0653
#> 5: 1 3 22.313 2.2313 3.6788
#> 6: 1 4 13.534 1.3534 2.2313
#> 7: 1 5 8.208 0.8208 1.3534
#> 8: 1 6 4.979 0.4979 0.8208 Created on 2022-12-07 with reprex v2.0.2 Kyle |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm currently trying to get a column on my $TABLE that records the values of the Y for the previous time point for each individual (the sort of data management that you'd do on R) with the ouput of my model.
Something like this:
ID | TIME | YCUR | YPRED | Y
1 | 0.00 | 0.00 | 0.00 | -1
1 | 1.00 | 1.50 | 0.00 | 1.5
1 | 2.00 | 3.50 | 1.50 | 3.5
1 | 3.00 | 7.00 | 3.50 | 7.0
The reason for it is to establish a right-censoring based on the condition that Y goes below a certain value AND the YCUR > YPRED (the beaviour is already in terminal phase). But I don't really know how to do this
This is my code so far:
Hopefully you could help me with it :)
Thanks
Beta Was this translation helpful? Give feedback.
All reactions