model_response: Simulate response variable

Description Usage Arguments Details Value Author(s) Examples

Description

function description.

Usage

1
2
3
model_response(model_frame, formula = attr(model_frame, "formula"),
  link_inv = replicate(length(formula), identity), generator = rnorm,
  responses = c("response"), seed = NULL)

Arguments

model_frame

A tibble containing all the covariates to be used. Usually this is obtained as the output of the model_frame function.

formula

An optional list of formulas to simulate the parameters of the response variables.

link_inv

A list of function representing the inverse link function for the parameters.

generator

Function to generate the response variables given the parameters

responses

character vector indicating the names of the response variables

seed

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

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
20
21
22
23
f <- list(
  mean ~ I(5 + 0.5 * x1 + 0.1 * x2 + 0.7 * id1),
  sd ~ I(x1)
)
(model_fr <- model_frame(f, n = 10))
(data <- model_response(model_fr, link = list(identity, exp)))

beta0 <- c(-1, 1)
# Structure of the model
formula <- list(
  mean ~ fa(sex, beta = get("beta0")),
  sd ~ I(0)
)
(model_fr <- model_frame(formula, n = 10))
(data <- model_response(model_fr, link = list(identity, exp)))

formula <- list(
  mean ~ mfe(x, beta = 1:2),
  sd ~ mfe(x1, beta = 1:2)
)
(model_fr <- model_frame(formula, n = 10))
#(data <- model_response(model_fr, link_inv = list(identity, exp), responses = 1:2))
#(data <- sim_model(formula, link_inv = list(identity, exp), n = 10, responses = 1:2))

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