Skip to contents

fit_omnibus() fits a nonlinear mixed-effects model in which the primary model is one of the parameterised predmicror primary models and one or more primary-model parameters are described by secondary covariate formulas.

Usage

fit_omnibus(
  data,
  type = c("growth", "inactivation"),
  primary,
  time,
  response,
  group,
  secondary = NULL,
  random,
  correlation = NULL,
  start,
  method = "ML",
  control = NULL,
  ...
)

fit_omnibus_growth(
  data,
  primary,
  time,
  response,
  group,
  secondary = NULL,
  random,
  correlation = NULL,
  start,
  method = "ML",
  control = NULL,
  ...
)

fit_omnibus_inactivation(
  data,
  primary,
  time,
  response,
  group,
  secondary = NULL,
  random,
  correlation = NULL,
  start,
  method = "ML",
  control = NULL,
  ...
)

Arguments

data

A data frame.

type

Character string. One of "growth" or "inactivation".

primary

Character string naming a primary model registered in predmicror, for example "HuangNLM" or "WeibullM".

time, response, group

Column names for time, response, and grouping variable.

secondary

Optional named list of formulas, one per primary-model parameter. Parameters not listed are modelled as intercept-only effects.

random

Random-effects formula passed to nlme::nlme(). If the formula does not include a grouping term, | group is added automatically.

correlation

Optional correlation structure. Use "AR1" for nlme::corAR1() within groups, NULL for none, or pass an nlme correlation object.

start

Numeric vector of starting values for fixed effects, in the order expected by nlme::nlme().

method

Estimation method passed to nlme::nlme().

control

Optional nlme::nlmeControl() object.

...

Additional arguments passed to nlme::nlme().

Value

A predmicror_omnibus_fit object.

Examples

set.seed(1)
dat <- do.call(rbind, lapply(1:4, function(g) {
  Time <- c(1, 2, 4, 6, 8, 10)
  sigma <- 5 + 0.4 * g
  data.frame(
    Condition = g,
    Time = Time,
    Temp = 55 + g,
    logN = WeibullM(Time, Y0 = 7, sigma = sigma, alpha = 1.1) +
      rnorm(length(Time), 0, 0.03)
  )
}))
fit <- fit_omnibus_inactivation(
  dat,
  primary = "WeibullM",
  time = "Time",
  response = "logN",
  group = "Condition",
  secondary = list(sigma = ~ Temp),
  random = Y0 ~ 1,
  start = c(Y0 = 7, sigma = 1, sigma.Temp = 0.08, alpha = 1)
)
fit_metrics(fit)
#>      model                 type response response_scale  n p       SSE
#> 1 WeibullM omnibus_inactivation     logN         log10N 24 4 0.0178355
#>        RMSE        MAE         bias       RSE        R2    adj_R2  logLik
#> 1 0.0272607 0.02180912 4.219951e-09 0.0298626 0.9995866 0.9994995 52.4009
#>         AIC       BIC converged
#> 1 -92.80179 -85.73347      TRUE