gen.binomial.data {glmtlp} | R Documentation |
Simulate a binomial data set
Description
Simulate a data set with binary response following the logistic regression model.
Usage
gen.binomial.data(n, p, rho = 0, kappa = 5, beta.type = 1, seed = 2021)
Arguments
n |
Sample size. |
p |
Number of covariates. |
rho |
The parameter defining the AR(1) correlation matrix. |
kappa |
The number of nonzero coefficients. |
beta.type |
Numeric indicator for choosing the beta type. For
|
seed |
The seed for reproducibility. Default is 2021. |
Value
A list containing the simulated data.
X |
the covariate matrix, of dimension |
y |
the response, of length |
beta |
the true coefficients, of length |
Examples
bin_data <- gen.binomial.data(n = 200, p = 20, seed = 2021)
head(bin_data$X)
head(bin_data$y)
head(bin_data$beta)