# Sequence command to initialize a differential equa

**URL:** <https://forum.certara.com/t/sequence-command-to-initialize-a-differential-equa/2364>\
**Category:** Modelling and Simulation\
**Created:** [February 13, 2012, 10:36am UTC](https://forum.certara.com/t/sequence-command-to-initialize-a-differential-equa/2364 "2012-02-13T10:36:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mike\_walker99](https://avatars.discourse-cdn.com/v4/letter/m/a9a28c/32.png) [@mike\_walker99](https://forum.certara.com/u/mike_walker99)\
**Post date:** [February 13, 2012, 10:36am UTC](https://forum.certara.com/t/sequence-command-to-initialize-a-differential-equa/2364/1 "2012-02-13T10:36:10Z")

</div>

Hi, I’ve got a question about the sequence command when used with a differential equation model. In the model below I’m using the sequence command to set the initial condition of each individual to a value of 169 which is the mean value for each of my individuals at time zero, but I have a measured value for each individual. What I would like to know is there a way I can set each individuals initial condition to their measured value either by entering each piece of data in or (preferably) reading it from the data? Thanks, Mike test(){ deriv(TuV = (lam0 - (k2\*C))\*TuV) cfMicro(A1, Ke, first = (Aa = Ka)) dosepoint(Aa) C = A1 / V sequence{TuV = 169} error(TuVEps = 1) observe(TuVObs = TuV \* (1 + TuVEps)) stparm(Ka = tvKa) stparm(V = tvV) stparm(Ke = tvKe) stparm(lam0 = tvlam0 \* exp(nlam0)) stparm(k2 = tvk2 \* exp(nk2)) fixef(tvKa(freeze) = c(, 0.2, )) fixef(tvV(freeze) = c(, 0.5, )) fixef(tvKe(freeze) = c(, 2, )) fixef(tvlam0 = c(0, 0.0009, )) fixef(tvk2 = c(0, 0.0005, )) ranef(diag(nlam0, nk2) = c(1, 1)) }

---

<div class="post-metadata">

**Author:** ![da3367](https://avatars.discourse-cdn.com/v4/letter/d/a183cd/32.png) [@da3367](https://forum.certara.com/u/da3367)\
**Post date:** [February 13, 2012, 4:09pm UTC](https://forum.certara.com/t/sequence-command-to-initialize-a-differential-equa/2364/2 "2012-02-13T16:09:41Z")

</div>

Hi Mike, There are two options: 1. Use the value as a covariate. Put the initial condition in the dataset in a new column (e.g. “TuV0”). You will only need to fill in each individuals value at time = 0, leaving the rest blank. Put a statement “covariate(TuV0)” in your model and modify the sequence statement to “sequence{TuV = TuV0}”. This method assumes there is no error in your observation of the initial condition. 2. Let the algorithm solve for the starting point. Create a stparm for the initial condition and assign it in the sequence statement. fixef(tvTuV0 = 169) stparm(TuV0 = tvTuV0\*exp(nTuV0)) sequence{TuV=TuV0} ranef(nTuV0 = 1) This method allows for observation error at the zero time. Happy modeling, -Jason

---

<div class="post-metadata">

**Author:** ![mike\_walker99](https://avatars.discourse-cdn.com/v4/letter/m/a9a28c/32.png) [@mike\_walker99](https://forum.certara.com/u/mike_walker99)\
**Post date:** [February 14, 2012, 4:52pm UTC](https://forum.certara.com/t/sequence-command-to-initialize-a-differential-equa/2364/3 "2012-02-14T16:52:10Z")

</div>

Hi Jason, I tried the second option and it works fine. Thanks for your help. Mike
