sim.my {chngpt}R Documentation

Simulate data

Description

Simulate data

Usage

sim.my(n, seed, label, alpha, beta, e. = NULL, b. = NULL, tr. = NULL)

Arguments

n

Sample size

seed

Seed for random number generator

label

A character string which specifies the simulation scenario. sigmoid4, sigmoidgam4, elbow4

alpha

regression parameter

beta

regression parameter

e.

inflection point for the logistic transformation (the log scale)

b.

slope for the logistic transformation

tr.

threshold point

Details

When the label starts with elbow, the transformation on x.star is elbow shaped. When the label starts with sigmoid, the transformation on x.star is sigmoid shaped. Data simulated from logit(Pr(Y==1))=alpha + beta*(transformed x.star).

Value

A data frame with columns: y, x.star, x.star.expit (if label starts with sigmoid), x.star.tr (if label starts with elbow), x.bin.med (x.star dichotomized at median), x.tri (x.star trichotomized at tertiles).

Examples


alpha=-1; beta=log(0.2)
e.=5; b.=-30; t.=1
dat=sim.my(n=250, seed=1, label="sigmoid4", alpha, beta, e.=e., b.=b.)


[Package chngpt version 2023.11-29 Index]