View source: R/k-ontram_methods.R
simulate.k_ontram | R Documentation |
Simulate Responses
## S3 method for class 'k_ontram'
simulate(object, x, nsim = 1, levels = NULL, seed = NULL)
object |
an object of class |
x |
list of data matrices (including matrix containing 1 if model intercept is non-complex) |
nsim |
number of simulations. |
levels |
levels of simulated ordered responses. |
seed |
random seed. |
data(wine, package = "ordinal")
fm <- rating ~ temp + contact
y <- model.matrix(~ 0 + rating, data = wine)
x <- ontram:::.rm_int(model.matrix(fm, data = wine))
loss <- k_ontram_loss(ncol(y))
mbl <- k_mod_baseline(ncol(y), name = "baseline")
msh <- mod_shift(ncol(x), name = "linear_shift")
mo <- k_ontram(mbl, msh)
compile(mo, optimizer = optimizer_adam(learning_rate = 10^-4), loss = loss)
fit(mo, x = list(matrix(1, nrow = nrow(wine)), x), y = y, batch_size = nrow(wine), epoch = 10)
simulate(mo, x = list(matrix(1, nrow = nrow(wine)), x), nsim = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.