cotramNN {deeptrafo} | R Documentation |
Deep distribution-free count regression
Description
Deep distribution-free count regression
Usage
cotramNN(
formula,
data,
response_type = get_response_type(data[[all.vars(formula)[1]]]),
order = get_order(response_type, data[[all.vars(formula)[1]]]),
addconst_interaction = 0,
latent_distr = "logistic",
monitor_metrics = NULL,
...
)
Arguments
formula |
Formula specifying the response, interaction, shift terms
as |
data |
Named |
response_type |
Character; type of response. One of |
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 |
latent_distr |
A |
monitor_metrics |
See |
... |
Additional arguments passed to |
Value
See return statement of deeptrafo
Examples
set.seed(1)
df <- data.frame(y = as.integer(abs(1 + rnorm(50, sd = 10))), x = rnorm(50))
if (reticulate::py_module_available("tensorflow") &
reticulate::py_module_available("keras") &
reticulate::py_module_available("tensorflow_probability")) {
m <- cotramNN(y ~ 0 + x, data = df, order = 6)
optimizer <- optimizer_adam(learning_rate = 0.1, decay = 4e-4)
m <- cotramNN(y ~ 0 + x, data = df, optimizer = optimizer, order = 6)
library(cotram)
fit(m, epochs = 800L, validation_split = 0)
logLik(mm <- cotram(y ~ x, data = df, method = "logit")); logLik(m)
coef(mm, with_baseline = TRUE); unlist(c(coef(m, which = "interacting"),
coef(m, which = "shifting")))
}