ontram {deeptrafo}R Documentation

Ordinal neural network transformation models

Description

Ordinal neural network transformation models

Usage

ontram(
  response,
  intercept = NULL,
  shift = NULL,
  shared = NULL,
  data,
  response_type = "ordered",
  order = get_order(response_type, data[[all.vars(response)[1]]]),
  addconst_interaction = 0,
  latent_distr = "logistic",
  monitor_metrics = NULL,
  trafo_options = trafo_control(order_bsp = order, response_type = response_type),
  ...
)

Arguments

response

Formula for the response; e.g., ~ y

intercept

Formula for the intercept function; e.g., ~ x, for which interacting bases with the response will be set up

shift

Formula for the shift part of the model; e.g., ~ s(x)

shared

Formula for sharing weights between predictors in the intercept and shift part of the model

data

Named list or data.frame which may contain both structured and unstructured data.

response_type

Character; type of response. One of "continuous", "survival", "count", or "ordered". If not supplied manually it is determined by the first entry in data[[response]].

order

Integer; order of the response basis. Default 10 for Bernstein basis or number of levels minus one for ordinal responses.

addconst_interaction

Positive constant; a constant added to the additive predictor of the interaction term. If NULL, terms are left unchanged. If 0 and predictors have negative values in their design matrix, the minimum value of all predictors is added to ensure positivity. If > 0, the minimum value plus the addconst_interaction is added to each predictor in the interaction term. This ensures a monotone non-decreasing transformation function in the response when using (tensor product) spline bases in the interacting term.

latent_distr

A tfd_distribution or character; the base distribution for transformation models. If character, can be "normal", "logistic", "gumbel" or "gompertz".

monitor_metrics

See deepregression

trafo_options

Options for transformation models such as the basis function used, see trafo_control for more details.

...

Additional arguments passed to deepregression

Value

See return statement of deeptrafo

References

Kook, L. & Herzog, L., Hothorn, T., Dürr, O., & Sick, B. (2022). Deep and interpretable regression models for ordinal outcomes. Pattern Recognition, 122, 108263. DOI 10.1016/j.patcog.2021.108263

Examples

df <- data.frame(y = ordered(sample.int(6, 50, TRUE)), x = rnorm(50))
if (reticulate::py_module_available("tensorflow") &
    reticulate::py_module_available("keras") &
    reticulate::py_module_available("tensorflow_probability")) {
    m <- ontram(response = ~ y, shift = ~ x, data = df)
   coef(m)
}


[Package deeptrafo version 0.1-1 Index]