model_frame: Simulate covariates based on model formula

Description Usage Arguments Details Value Author(s) Examples

Description

function description.

Usage

1
2
model_frame(formula, n = nrow(idata)/q, idata = NULL, q = 1,
  seed = NULL)

Arguments

formula

List of the parameters, indicating how they should be computed. similar to formula for lm, glm, bamlss, with the difference that it included the coefficients and link function explicitly.

n

Number of observations to be simulated

idata

Initial data including some variables to not been simulated.

q

number of response variables

seed

Seed to be defined with function set.seed to obtain reproducible

Details

details.

Value

return.

Author(s)

Erick A. Chacon-Montalvan

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# Structure of the model
formula <- list(
  mean ~ I(age ^ 2) + fa(sex, beta = c(-1, 1)),
  sd ~ fa(sex, beta = c(1, 2))
)
idata <- data.frame(s1 = 1:10)
(datasim <- model_frame(formula, idata = idata))
(datasim <- model_frame(formula, n = 10))

formula <- list(
  mean ~ I(5) + I(0.5 * x1) + I(0.1 * x2),
  sd ~ I(2) + I(x)
)

# Structure of the model
formula <- list(
  mean ~ fa(sex, beta = c(-1,1)),
  sd ~ I(0)
)

ErickChacon/datasim documentation built on March 25, 2020, 7:53 p.m.