simulXy: Simulate model matrix and response

View source: R/auxiliary.R

simulXyR Documentation

Simulate model matrix and response

Description

Simulate model matrix and response from a specified distribution.

Usage

simulXy(n, p, interc = 0, beta, family = gaussian(), prop =
  0.1, lim.b = c(-3, 3), sigma = 1, size = 1, rho = 0,
  scale = TRUE, seed, X)

Arguments

n

number of observations.

p

total number of covariates in the model matrix.

interc

the model intercept.

beta

the vector of p coefficients in the linear predictor.

family

a description of the error distribution and link function to be used in the model. This can be a character string naming a family function, a family function or the result of a call to a family function. Only gaussian, binomial or poisson are allowed.

prop

if beta is missing, prop represent the quote of non-null coefficients out of p. The default is 0.10 p.

lim.b

if beta is missing, the coefficients come from uniform variates in lim.b. The default is (-3,3).

sigma

if family is 'gaussian', the standard deviation of the response. The default is 1.

size

if family is 'binomial', the number of trials to build the response vector. The default is 1.

rho

correlation value to define the variance covariance matrix to build the model matrix, i.e., rho^|i-j| i,j = 1,...,p and i different from j. The default is 0.

scale

Should the columns of the mdoel matrix be scaled? The default is TRUE

seed

optional, the seed to generate the data.

X

optional, the model matrix.

Examples


n <- 100
p <- 100
beta <- c(runif(10, -3, 3), rep(0, p-10))
dat <- simulXy(n, p,  beta = beta, seed=1234)

islasso documentation built on May 31, 2023, 8:37 p.m.