fit_inactivation_MCMC: Fitting of dynamic inactivation with MCMC

Description Usage Arguments Value Examples

View source: R/fit_MCMC.R

Description

Fits the parameters of an inactivation model to experimental using the Markov Chain Monte Carlo fitting algorithm implemented in the function modMCMC of the package FME.

Usage

1
2
3
fit_inactivation_MCMC(experiment_data, simulation_model, temp_profile,
  starting_points, upper_bounds, lower_bounds, known_params, ...,
  minimize_log = TRUE, tol0 = 1e-05)

Arguments

experiment_data

data frame with the experimental data to be adjusted. It must have a column named “time” and another one named “N”.

simulation_model

character identifying the model to be used.

temp_profile

data frame with discrete values of the temperature for each time. It must have one column named time and another named temperature providing discrete values of the temperature at time points.

starting_points

starting values of the parameters for the adjustment.

upper_bounds

named numerical vector defining the upper bounds of the parameters for the adjustment.

lower_bounds

named numerical vector defining the lower bounds of the parameters for the adjustment.

known_params

named numerical vector with the fixed (i.e., not adjustable) model parameters.

...

other arguments for modMCMC.

minimize_log

logical. If TRUE, the adjustment is based on the minimization of the error of the logarithmic count.

tol0

numeric. Observations at time 0 make Weibull-based models singular. The time for observatins taken at time 0 are changed for this value.

Value

A list of class FitInactivationMCMC with the following items:

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
27
28
29
30
## EXAMPLE 1 ------
data(dynamic_inactivation)  # The example data set is used.

get_model_data()  # Retrieve the valid model keys.

simulation_model <- "Peleg"  # Peleg's model will be used

model_data <- get_model_data(simulation_model)
model_data$parameters  # Set the model parameters

dummy_temp <- data.frame(time = c(0, 1.25, 2.25, 4.6),
                         temperature = c(70, 105, 105, 70))  # Dummy temp. profile

## Set known parameters and initial points/bounds for unknown ones

known_params = c(temp_crit = 100)

starting_points <- c(n = 1, k_b = 0.25, N0 = 1e+05)
upper_bounds <- c(n = 2, k_b = 1, N0 = 1e6)
lower_bounds <- c(n = 0.5, k_b = 0.1, N0 = 1e4)

MCMC_fit <- fit_inactivation_MCMC(dynamic_inactivation, simulation_model,
                                     dummy_temp, starting_points,
                                     upper_bounds, lower_bounds,
                                     known_params,
                                     niter = 100)
                                     # It is recommended to increase niter

plot(MCMC_fit)
## END EXAMPLE 1 -----

bioinactivation documentation built on Dec. 15, 2017, 5:04 p.m.