generateData {geeVerse}R Documentation

Generate Data for Simulation

Description

This function generates simulated data including the predictor matrix 'X' and the response vector 'y', based on the specified parameters. The function allows for the simulation of data under different settings of correlation, distribution, and the number of observations and subjects.

Usage

generateData(n_sub, n_obs, p, beta0, rho, type = "ar", dis = "normal", ka)

Arguments

n_sub

Integer, the number of subjects.

n_obs

Integer or numeric vector, the number of observations per subject.

p

Integer, the number of predictors.

beta0

Numeric vector, initial coefficients for the first few predictors.

rho

Numeric, the correlation coefficient used in generating correlated errors.

type

Character, the type of correlation structure (default is autoregressive).

dis

Character, the distribution of errors ("normal" or "t").

ka

1 for heterogeneous errors and 0 for homogeneous errors.

Value

A list containing two elements: 'X', the matrix of predictors, and 'y', the response vector.

Examples

sim_data <- generateData(n_sub = 100, n_obs = rep(10, 100),  p = 200,
                         beta0 = rep(1,7), rho = 0.6, type = "ar",
                          dis = "normal", ka = 1)

[Package geeVerse version 0.1.0 Index]