SimData: Simulate data with normally distributed predictors and binary...

Description Usage Arguments Details Value Examples

View source: R/add.r

Description

Simulate data with normally distributed predictors and binary response

Usage

1
SimData(N, beta, noise, corr = TRUE, corr.effect = 0.5)

Arguments

N

sample size

beta

coefficients (effect of informative predictors)

noise

variables (effect of uninformative predictors)

corr

Logical, if FALSE the function generates uncorrelated predictors, if TRUE the correlation between predictors is 0.5 by default and the user can supply a different value in the corr.effect argument.

corr.effect

the correlation between informative predictors.

Details

The response y follows a Binomial distribution with probability= exp(X*beta)/(1+exp(X*beta))

Value

A data frame N x p, where p is the total number of informative and uninformative predictors. The first column of the dataframe is the binary response variable y

Examples

1
2
3
4
5
6
7
# simulate data with N=100 (sample size) and 23 predictors; 4 informative and 20 noise

set.seed(14)
beta    <- c(3, 2, -1.6, -4)
noise <- 5
N     <- 100
simData <- SimData(N=N, beta=beta, noise=noise, corr=FALSE)

stepPenal documentation built on May 1, 2019, 10:11 p.m.

Related to SimData in stepPenal...