Test if a model uses an autoregressive (ar()) residual
Value
logical, TRUE if any endpoint carries an ar() correlation
(either an estimated correlation or a modeled/literal one)
Examples
# \donttest{
mod <- function() {
ini({
tcl <- log(1)
tv <- log(10)
add.sd <- 0.5
ar1.cor <- 0.5
})
model({
cl <- exp(tcl)
v <- exp(tv)
d/dt(central) <- -cl / v * central
cp <- central / v
cp ~ add(add.sd) + ar(ar1.cor)
})
}
rxHasAr(mod)
#>
#>
#> ℹ parameter labels from comments are typically ignored in non-interactive mode
#> ℹ Need to run with the source intact to parse comments
#> [1] TRUE
# without ar() there is no autocorrelated residual
rxHasAr(mod |> model(cp ~ add(add.sd)))
#>
#>
#> ℹ parameter labels from comments are typically ignored in non-interactive mode
#> ℹ Need to run with the source intact to parse comments
#> ! remove population parameter `ar1.cor`
#> [1] FALSE
# }
