diagnostic {KGode} | R Documentation |
The 'diagnostic' function
Description
This function is used to perform diagnostic procedure to compute the residual and make diagnostic plots.
Usage
diagnostic(infer_list, index, type, qq_plot)
Arguments
infer_list |
a list of inference results including ode objects and inference objects. |
index |
the index of the ode states which the user want to do the diagnostic analysis. |
type |
character containing the type of inference methods. User can choose 'rkg', 'third', or 'warp'. |
qq_plot |
boolean variable, enable or disable the plotting function. |
Details
Arguments of the 'diagnostic' function are inference list , inference type, a list of interpolations for each of the ode state from gradient matching, and . It returns a vector of the median absolute standard deviations for each ode state.
Value
return list containing :
residual - vector containing residual.
interp - vector containing interpolation.
Author(s)
Mu Niu mu.niu@glasgow.ac.uk
Examples
## Not run:
require(mvtnorm)
set.seed(SEED); SEED = 19537
FN_fun <- function(t, x, par_ode) {
a = par_ode[1]
b = par_ode[2]
c = par_ode[3]
as.matrix(c(c*(x[1]-x[1]^3/3 + x[2]),-1/c*(x[1]-a+b*x[2])))
}
solveOde = ode$new(sample=2,fun=FN_fun)
xinit = as.matrix(c(-1,-1))
tinterv = c(0,10)
solveOde$solve_ode(par_ode=c(0.2,0.2,3),xinit,tinterv)
n_o = max(dim(solveOde$y_ode))
noise = 0.01
y_no = t(solveOde$y_ode)+rmvnorm(n_o,c(0,0),noise*diag(2))
t_no = solveOde$t
odem = ode$new(fun=FN_fun,grfun=NULL,t=t_no,ode_par=rep(c(0.1),3),y_ode=t(y_no))
ktype = 'rbf'
rkgres = rkg(odem,y_no,ktype)
rkgdiag = diagnostic( rkgres,1,'rkg',qq_plot=FALSE )
## End(Not run)