The goal of NMproject's covariate modelling functions is to provide a
stepwise covariate method *with manual decision* making. This important to
ensure that the full model selection/evaluation criteria (should be defined
in statistical analysis plans) can be applied at every step rather than just
log likelihood ratio testing, where the most significant model may be
unstable, may worsen model predictions or may only be slightly more
significant than a more physiologically plausible covariate relationship.

The functions `test_relations()`

, `covariate_step_tibble()`

,
`bind_covariate_results()`

together comprise NMproject stepwise covariate
method with manual decision. The goal is to be part way between PsN's SCM
and completely manual process at each forward and backward elimination step.
The syntax of how covariates are included is the same as PsN's SCM routine -
See PsN documentation
for more information.

`test_relations(dtest, param, cov, state, continuous)`

- dtest
Optional existing

`dtest`

to append (from an previous use`test_relations()`

).- param
Character. Name of parameter(s).

- cov
Character. Name of covariate(s).

- state
Numeric or character. Number/name of state (see details).

- continuous
Logical (default =

`TRUE`

). If`FALSE`

, will treat the covariate as categorical.

A `tibble`

describing relationships to test.

Setting vector values for `param`

, `cov`

, and `state`

, will expand the grid
to test each value with every other value greedily. This is similar to
`expand.grid()`

available states (see also `add_cov()`

):

- "2" or "linear"
PARCOV= ( 1 + THETA(1)*(COV -median))

- "3" or "hockey-stick"
IF(COV.LE.median) PARCOV = ( 1 + THETA(1)*(COV - median)) IF(COV.GT.median) PARCOV = ( 1 + THETA(2)*(COV - median))

- "4" or "exponential"
PARCOV= EXP(THETA(1)*(COV - median))

- "5" or "power"
PARCOV= ((COV/median)**THETA(1))

- "power1"
PARCOV= ((COV/median))

- "power0.75"
PARCOV= ((COV/median)**0.75)

- "6" or "log-linear"
PARCOV= ( 1 + THETA(1)*(LOG(COV) - log(median)))

```
dtest <- test_relations(param = c("KA", "K", "V"),
cov = c("LIN1", "LIN2", "LIN3", "RND1", "RND2", "RND3"),
state = c("linear", "power"),
continuous = TRUE) %>%
test_relations(param = c("KA", "K", "V"),
cov = "BN1",
state = "linear",
continuous = FALSE)
dtest
#> # A tibble: 39 × 4
#> param cov state continuous
#> <chr> <chr> <chr> <lgl>
#> 1 KA LIN1 linear TRUE
#> 2 K LIN1 linear TRUE
#> 3 V LIN1 linear TRUE
#> 4 KA LIN2 linear TRUE
#> 5 K LIN2 linear TRUE
#> 6 V LIN2 linear TRUE
#> 7 KA LIN3 linear TRUE
#> 8 K LIN3 linear TRUE
#> 9 V LIN3 linear TRUE
#> 10 KA RND1 linear TRUE
#> # … with 29 more rows
```