Simulation Function

Share:

Description

Generate simulation datasets for change point Monte Carlo studies.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
sim.chngpt(
    label=c("sigmoid2","sigmoid3","sigmoid4","sigmoid5","sigmoid6",
        "quadratic","exp","flatHyperbolic"), 
    n, seed, 
    type=c("NA","step","hinge","segmented","stegmented"),
    family=c("binomial","gaussian"),
    beta=NULL, coef.z=log(1.4), alpha=NULL,
    x.distr=c("norm","norm3","norm6","imb","lin","mix","gam","zbinary"),     
    e.=NULL, b.=-Inf,
    sd=0.3,
    alpha.candidate=NULL, verbose=FALSE) 

Arguments

label

string. Simulate scenario, see details.

type

string. Types of threshold effect to simulate, only applicable when label does not start with sigmoid.

family

string. Glm family.

n
seed
beta
coef.z

numeric. Coefficient for z.

alpha

numeric, intercept.

x.distr

string. Possible values: norm (normal distribution), gam (gamma distribution)

e.
verbose

Boolean

b.
sd
alpha.candidate

candidate values of alpha, used in code to determine alpha values

Details

When label is "sigmoid1", an intercept only model is the data generative model. When label is "sigmoid2", a binary covariate z is also part of the data generative model.

Value

A data frame with following columns:

y

0/1 outcome

x

observed covariate that we are interested in

x.star

unobserved covariate that underlies x

z

additional covariate

In addition, columns starting with 'w' are covariates that we also adjust in the model; columns starting with 'x' are covariates derived from x.