traindata: Simulated data sets to illustrate the package functionality

simulateddataR Documentation

Simulated data sets to illustrate the package functionality

Description

Both the traindata and testdata dataframe are synthetically generated data sets to illustrate the functionality of the package. The traindata has 1000 observations and the testdata has 500 observations. The same settings were used to generate both data sets.

Usage

  data(traindata)
  data(testdata)
  

Format

y

the binary outcome variable

x1

covariate 1

x2

covariate 2

x3

covariate 3

x4

covariate 4

Details

See the examples for how the data sets were generated.

Examples

  # The data sets were generated as follows
  set.seed(1782)

  # Simulate training data
  nTrain    = 1000
  B         = c(0.1, 0.5, 1.2, -0.75, 0.8)
  X         = replicate(4, rnorm(nTrain))
  p0true    = binomial()$linkinv(cbind(1, X) %*% B)
  y         = rbinom(nTrain, 1, p0true)
  colnames(X) = paste0("x", seq_len(ncol(X)))
  traindata = data.frame(y, X)

  # Simulate validation data
  nTest    = 500
  X        = replicate(4, rnorm(nTest))
  p0true   = binomial()$linkinv(cbind(1, X) %*% B)
  y        = rbinom(nTest, 1, p0true)
  colnames(X) = paste0("x", seq_len(ncol(X)))
  testdata = data.frame(y, X)

BavoDC/package.val.prob.ci.2 documentation built on March 16, 2024, 2:35 p.m.