sclr_ideal_data: Generate ideal data for the scaled logit model

Description Usage Arguments Value Examples

View source: R/sclr_ideal_data.R

Description

Allows variation of all parameters and the creation of an arbitrary number of covariates.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
sclr_ideal_data(
  n = 1000,
  theta = 0,
  beta_0 = -5,
  covariate_list = list(logHI = list(gen_fun = function(n) rnorm(n, 2, 2), true_par =
    2)),
  outcome_name = "status",
  seed = NULL,
  attach_true_vals = FALSE,
  attach_seed = FALSE
)

Arguments

n

Number of observations.

theta

Baseline risk parameter on the logit scale.

beta_0

Intercept of the linear part.

covariate_list

A list in the form of name = list(gen_fun, true_par) where gen_fun is a function that takes n as an argument and returns a vector of observations, true_par is the true parameter value of that covariate. See examples.

outcome_name

Name to give to the outcome

seed

Seed to set. If NULL, no seed will be set.

attach_true_vals, attach_seed

Whether to attach additional attributes.

Value

A tibble.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# One titre
one_titre <- sclr_ideal_data(
  covariate_list = list(
    logHI = list(gen_fun = function(n) rnorm(n, 2, 2), true_par = 2)
  )
)
sclr(status ~ logHI, one_titre) # Verify

# Two titres
two_titre <- sclr_ideal_data(
  covariate_list = list(
    logHI = list(gen_fun = function(n) rnorm(n, 2, 2), true_par = 2),
    logNI = list(gen_fun = function(n) rnorm(n, 2, 2), true_par = 1)
  )
)
sclr(status ~ logHI + logNI, two_titre) # Verify

khvorov45/sclr documentation built on March 4, 2020, 7:17 p.m.