Learn R Programming

stepPenal (version 0.2)

SimData: Simulate data with normally distributed predictors and binary response

Description

Simulate data with normally distributed predictors and binary response

Usage

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.

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

Details

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

Examples

Run this code
# NOT RUN {
# 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)

# }

Run the code above in your browser using DataLab