simulate.sklarsomega: Simulate a Sklar's Omega dataset(s).

View source: R/sklarsomega.R

simulate.sklarsomegaR Documentation

Simulate a Sklar's Omega dataset(s).

Description

Simulate a Sklar's Omega dataset(s).

Usage

## S3 method for class 'sklarsomega'
simulate(object, nsim = 1, seed = NULL, ...)

Arguments

object

a fitted model object.

nsim

number of datasets to simulate. Defaults to 1.

seed

either NULL or an integer that will be used in a call to set.seed before simulating the response vector(s). If set, the value is saved as the "seed" attribute of the returned value. The default (NULL) will not change the random generator state, and .Random.seed will be returned as the "seed" attribute.

...

additional arguments.

Details

This function simulates one or more responses distributed according to the fitted model.

Value

A data frame having nsim columns, each of which contains a simulated response vector. Said data frame has a "seed" attribute, which takes the value of the seed argument or the value of .Random.seed.

Examples

# Fit a subset of the cartilage data, assuming a Laplace marginal distribution.

data(cartilage)
data.cart = as.matrix(cartilage)[1:100, ]
colnames(data.cart) = c("c.1.1", "c.2.1")
fit.lap = sklars.omega(data.cart, level = "balance", confint = "none",
                       control = list(dist = "laplace"))
summary(fit.lap)

# Simulate three datasets from the fitted model, and then display the
# head of the first dataset in matrix form.

sim = simulate(fit.lap, nsim = 3, seed = 42)
data.sim = t(fit.lap$data)
data.sim[! is.na(data.sim)] = sim[, 1]
data.sim = t(data.sim)
head(data.sim)

sklarsomega documentation built on April 4, 2023, 5:15 p.m.