Displaying 1 result from an estimated 1 matches for "scaled_transmission".
2007 Jun 06
3
Using odesolve to produce non-negative solutions
...*S*I/N) - (death*I) - (recover*I)
rhat <- (birth*(vax)) + (recover*I) - (death*R)
## Do we overshoot into negative space, if so shrink derivative to bring state to 0
## then rescale the components that take the derivative negative
if (shat+S<0) {
shat_old <- shat
shat <- -1*S
scaled_transmission <- (shat/shat_old)*(beta*S*I/N)
ihat <- scaled_transmission - (death*I) - (recover*I)
}
if (ihat+I<0) {
ihat_old <- ihat
ihat <- -1*I
scaled_recovery <- (ihat/ihat_old)*(recover*I)
rhat <- scaled_recovery +(birth*(vax)) - (death*R)
}
if (rhat+R<0) {
rh...