# diagnostic: The 'diagnostic' function In KGode: Kernel Based Gradient Matching for Parameter Inference in Ordinary Differential Equations

## Description

This function is used to perform diagnostic procedure to compute the residual and make diagnostic plots.

## Usage

 `1` ```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

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26``` ```## 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) ```

KGode documentation built on July 8, 2020, 6:49 p.m.