dynemu_GP {dynemu}R Documentation

Fit Gaussian process (GP) emulators for One-step-ahead approach

Description

The function fits GP emulators for each state variable by solving an ODE model one step ahead and using the generated outputs as training data.

Usage

dynemu_GP(odefun, times, param, X)

Arguments

odefun

function defining the ODE system. It should return a list where the first element is a numeric vector of derivatives.

times

numeric vector of time points where the solution is computed. Only the first two time points are used for one-step-ahead prediction.

param

numeric scalar or vector of parameters to be passed to odefun.

X

A matrix where each row represents an initial condition for the ODE system. Column names must be provided to match the state variables in odefun.

Details

Given an initial set of input conditions, this function: 1. Solves the ODE system for a short time interval using dyn_solve. 2. Fits GP emulators to model the next-step evolution of each state variable.

The ODE system is defined by the user through odefun, and the GP emulators are trained using the generated one-step-ahead outputs.

Value

A list of GP emulators, each corresponding to a state variable.

Examples

library(lhs)
### Lotka-Volterra equations ###
LVmod0D <- function(Time, State, Pars) {
  with(as.list(c(State, Pars)), {
    IngestC <- rI * P * C
    GrowthP <- rG * P * (1 - P/K)
    MortC <- rM * C

    dP <- GrowthP - IngestC
    dC <- IngestC * AE - MortC
    return(list(c(dP, dC)))
  })
}

### Define parameters ###
pars <- c(rI = 1.5, rG = 1.5, rM = 2, AE = 1, K = 10)

### Define time sequence ###
times <- seq(0, 30, by = 0.01)

### Initial conditions ###
set.seed(1)
d <- 2
n <- 12*d
Design <- maximinLHS(n, d) * 5 # Generate LHS samples in range [0,5]
colnames(Design) <- c("P", "C")

### Fit GP emulators ###
fit.dyn <- dynemu_GP(LVmod0D, times, pars, Design)
print(fit.dyn)


[Package dynemu version 1.0.0 Index]