Learn R Programming

predieval (version 0.1.1)

simbinary: Simulate data for a binary outcome

Description

This function generates a dataframe with 6 patient covariates and a binary outcome simulated from a model that uses the covariates.

Usage

simbinary(Npat = 100)

Arguments

Npat

Number of patients to simulate.

Value

The function returns a dataframe with:

x1, x2, x3, x4, x5, x6= patient covariates.

t= treatment assignment (0 for control, 1 for active).

logit.control= the logit of the probability of an outcome in the control treatment.

logit.active= the logit of the probability of an outcome in the active treatment.

benefit= treatment benefit in log odds ratio.

py=the probability of the outcome for each patient, under the treatment actually administered.

logit.py= the logit of py.

y.observed= the observed outcome

Examples

Run this code
# NOT RUN {
dat1=simbinary(100)$dat
head(dat1)
# }

Run the code above in your browser using DataLab