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

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

# 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
#> Call: status ~ logHI #> #> Parameter estimates #> theta beta_0 beta_logHI #> -0.06484168 -4.42520145 1.78120196 #> #> 95% confidence intervals #> 2.5 % 97.5 % #> theta -0.3135404 0.183857 #> beta_0 -6.3939538 -2.456449 #> beta_logHI 1.1539529 2.408451 #> #> Log likelihood: -502.8787
# 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
#> Call: status ~ logHI + logNI #> #> Parameter estimates #> theta beta_0 beta_logHI beta_logNI #> 0.02772784 -5.37529345 1.98366325 1.08743525 #> #> 95% confidence intervals #> 2.5 % 97.5 % #> theta -0.2334394 0.2888951 #> beta_0 -7.3368815 -3.4137054 #> beta_logHI 1.3900955 2.5772310 #> beta_logNI 0.7297320 1.4451385 #> #> Log likelihood: -372.2128