Looking at the info in the user guide for discrete events, it seems that the examples given all relate to time. I have two sets of concentrations as observed data, and I would like to specify that a model parameter has a certain value while the first set of concentrations (Ccellu) is lower than the other (Cmedu), but that this parameter is then equal to zero when the Ccellu become equal to or greater than Cmedu. I’ve tried this in various ways (see below) but none of them work. Is this even possible? Can anyone help, please? Try 1 CLup = 0.158256 sequence{if (Ccellu=Cmedu) CLup = 0;} Try 2 CLup = 0.158256 sequence{if (Ccellu>Cmedu) CLup = 0;} Try 3 CLup = 0.158256 sequence{sleep (Ccellu=Cmedu) CLup = 0;} Try 4 CLup = 0.158256 sequence{sleep (Ccellu>Cmedu) CLup = 0;}
That is just an idea. Let us start with something like that. I guess the ocndition will be met during the integration process. Therefore you need to cut it by pieces and I used 0.1 as deltatime but no idea what is your time scale. Take let say 1/10 the avwerage time between observation. The program will stop every time and look at the ocndition. Depending if the condition is met or not, switch1 will have 1 or 0 and this will define CLup either 0 or CLup2. If you have the project, I can help more. Best Serge double (switch1) # defines a parameters that can change only when the model stops stparm(CLup2 = tvCLup2 * exp(nCLup2)) CLup=switch1*CLup2 stparm(V2 = tvV2 * exp(nV2)) fixef(tvCLup2= c(, 1, )) ranef(diag(nCLup2) = c(1)) sequence { switch1=1 # let ODEs run for short time increments until the end condition is met while(Ccellu <= Cmedu) { switch1=1 sleep(0.1) # you decide how much time to run depenidng on your time scale which I do not know. use small time reltive to the time between observations } # closes the while sleep(0.1); # let ODEs run for 0.1 time units switch1=0 # now Ccellu > Cmedu } # closes the sequence
Try this: CLup = 0.158256 * (Ccellu < Cmedu) I don’t think you need a sequence for this.