Skip to contents

Simulates data for transfer learning.

Usage

sim.data.transfer(
  prob.common = 0.05,
  prob.separate = 0.05,
  q = 3,
  n0 = c(50, 100, 200),
  n1 = 10000,
  p = 200,
  rho = 0.5,
  family = "gaussian"
)

Arguments

prob.common

probability of common effect

prob.separate

probability of separate effect

q

number of datasets: integer

n0

number of training samples: integer vector of length q

n1

number of testing samples for all datasets: integer

p

number of features: integer

rho

correlation (for decreasing structure)

family

character "gaussian" or "binomial"

Value

Returns a list with slots y_train and X_train for training data, y_test and X_test for testing data, and beta for effects. The training data contains vectors of different lengths (y_train) and matrices with different number of rows (X_train).

Examples

data <- sim.data.transfer()
sapply(X=data$y_train,FUN=length)
#> [1]  50 100 200
sapply(X=data$X_train,FUN=dim)
#>      [,1] [,2] [,3]
#> [1,]   50  100  200
#> [2,]  200  200  200
sapply(X=data$y_test,FUN=length)
#> [1] 10000 10000 10000
sapply(X=data$X_test,FUN=dim)
#>       [,1]  [,2]  [,3]
#> [1,] 10000 10000 10000
#> [2,]   200   200   200
dim(data$beta)
#> [1] 200   3