///////////////////////////////////////////////////////////////////////// // initializePerson - Sets ///////////////////////////////////////////////////////////////////////// public void initializePerson() { // Acumulator values lifeYears = 0; qalyTotal = 0; ageAtDeath = 0; // Status values timeSinceSimStart = 0; stage = K.initStage; timeInCurrentStage = 0; firstSimCycle = true; relapseStatus = K.RelapseHx.NEVER_RELAPSED; // Half timestep correction age(K.DELTA_TIME * 0.5); // Flag that the subject is on the first cycle through the model firstSimCycle = false; }
///////////////////////////////////////////////////////////////////////// // doStage_B - relapse state ///////////////////////////////////////////////////////////////////////// public void doStage_B(double deltaTime) { // Initialize transition probabilities and rates to zero zeroOutProbs(); // Set haveRelapsed flag to TRUE relapseStatus = K.RelapseHx.HAVE_RELAPSED; // If limit reached for time in relapse state (B) reached, then go to cured state (C1) if (timeInCurrentStage + deltaTime >= K.maxTimeInB[(int)treatment].ElementAt(0)) { probToC1 = 1; } // If limit for time in relapse state (B) not reached, then there is no possibility of cure (C1). So // figure out if the subject dies - i.e., goes to (D) if (timeInCurrentStage + deltaTime < K.maxTimeInB[(int)treatment].ElementAt(0)) { probToC1 = 0; foreach (List <double> row in K.probBtoD[(int)treatment]) { if (timeInCurrentStage >= row[(int)K.probBtoD_dims.START] && timeInCurrentStage < row[(int)K.probBtoD_dims.STOP]) { List <double> myArray = new List <double>(2); for (int i = 0; i < 2; i++) { myArray.Add(0); } myArray[(int)K.ProbTimePair.PROB] = row[(int)K.probBtoD_dims.PROB]; myArray[(int)K.ProbTimePair.YEARS] = row[(int)K.probBtoD_dims.STOP] - row[(int)K.probBtoD_dims.START]; probToD = Utility.getProb(myArray, deltaTime); } } } }