sim_X: Simulate initial X values

View source: R/sim_rejection.R

sim_XR Documentation

Simulate initial X values

Description

Simulate initial X values

Usage

sim_X(n, fam_x, theta, offset, sim = TRUE)

Arguments

n

number of observations

fam_x

number for distribution family

theta

parameters for model

offset

optional mean correction

sim

should variables be simulated?

Details

Returns a list that includes a data frame containing a column x, as well as the density that was used to generate it. Possible families are Gaussian (=1), t (=2), Exponential (=3), beta (=4) Bernoulli/categorical (=5) and log-normal (=6).

For the exponential distribution, theta is the mean. Beta can take one or two parameters, and if there is only one it is just repeated.

The offset parameter alters the median for the normal and t-distributions, or the median of the logarithm in the case of a log-normal.

Value

A list with two entries: x a vector of the simulated values, and qden, which contains a function that evaluates to the density of the distribution used to generate those values.


rje42/causl documentation built on June 1, 2025, 2:50 p.m.