simulate.k_ontram: Simulate Responses

View source: R/k-ontram_methods.R

simulate.k_ontramR Documentation

Simulate Responses

Description

Simulate Responses

Usage

## S3 method for class 'k_ontram'
simulate(object, x, nsim = 1, levels = NULL, seed = NULL)

Arguments

object

an object of class k_ontram.

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.

Examples

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)

LucasKookUZH/ontram-pkg documentation built on March 27, 2023, 6:05 p.m.