This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' robustODE function | |
#' | |
#' @export | |
robustODE <- function(LS, init = initPars, crit.Tukey = 0.01, crit.huber = 0.05, optim.ctrl, resODE, maxit = 10) { | |
environment(LS) <- environment() | |
if (missing(resODE)) stop("Provide function to calculate residual") | |
## ========================================================================= | |
## IRLS and robust | |
## ========================================================================= | |
# 1. Obtain starting values. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' MetropolisAP function | |
#' | |
#' Using fixed range covariance adjusting strategy. | |
#' @export | |
#' MetropolisAP() | |
MetropolisAP <- function( | |
Y, # the data | |
tData, # corresponding time points | |
Inits = smidR:::state,# Vector of initial values | |
model = smidR::UIV, # Model for deSolve |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Threestates = function(t,state,parameters) { | |
with(as.list(c(state,parameters)),{ | |
dU = - pBeta*U*V | |
dI = pBeta*U*V - pDelta*I | |
dV = pP*I - pC*V | |
list(c(dU,dI,dV)) | |
}) | |
} | |
times <- seq(0, 12, by = 0.01) |