rdat: Simulates data from an RCT according to the following model:...

Description Usage Arguments Value Examples

View source: R/rdat.R

Description

Simulates data from an RCT according to the following model: 2 + 2*sign(x1<cut2) + beta1*trt*subgrp + beta2*(1-trt)*subgrp + N(0,sigma) If depth=1, then subgrp=(x1<=cut1) If depth!=1 then subgrp=(x1>=0.3 & x3>=0.1)

Usage

1
2
rdat(n = 100, K = 50, beta1 = 2, beta2 = 2, sigma = 1, cut1 = 0.5,
  cut2 = 0.5, depth = 1)

Arguments

n

size of the dataset to be generate. Defaults to 100.

beta1

controls the strength of the treatment effect. Defaults to 2.

beta2

controls the strength of the noise. Defaults to 2.

sigma

controls standard deviation of random variation. Defaults to 1.

depth

gives the number of interacting covariates. If set to 1, then then covariate X1 interacts with treatment. If set to another value, then covariates X1 and X3 both interact with treatment effect (one-way interactions). Defaults to 1.

cut1/cut2

controls where the cutpoints are to define subgroups.

Value

dataframe containing y (outcome), x1-x4 (covariates), trt (treatment), prtx (probability of being in treatment group)

Examples

1
2
3
data<-rdat(n=500)
This generates a dataframe with 500 observations, X1 as the only variable interacting with 
the treatment, and a signal to noise ratio of 2/2=1.

jinjinzhou/ITR.Tree documentation built on May 19, 2019, 10:36 a.m.