comp_Model {Compack}R Documentation

Simulation for log-contrast model.

Description

Simulate data for log-contrast model with a single set of compositional data.

Usage

comp_Model(n, p, rho = 0.2, sigma = 0.5, gamma = 0.5, add.on = 1:5,
           beta = c(c(1, -0.8, 0.6, 0, 0, -1.5, -0.5, 1.2), rep(0, times = p - 8)),
           beta0  = 1, intercept = TRUE)

Arguments

n

sample size

p

number of components in the compositional data

rho

parameter used to generate the p*p autocorrelation matrix for correlations among the components. Default is 0.2.

sigma

standard deviation for the noise terms, which are iid normal with mean 0. Default is 0.5.

gamma

a scaler. For the high level mean component(s), log(p * gamma) is added to the "non-normalized" data w_i before the data are converted to compositional.

add.on

an index vector with value(s) in [1,p], specifying which component(s) of compositions is of high level mean. Default is 1:5.

beta

coefficients for the compositional variables.

beta0

coefficient for the intercept. Default is 1.

intercept

whether to include an intercept. Default is FALSE.

Details

The setup of this simulation follows Lin, W., Shi, P., Peng, R. and Li, H. (2014) Variable selection in regression with compositional covariates, https://academic.oup.com/biomet/article/101/4/785/1775476.
Specifically, we first generate the correlation matrix among the components X.Sigma by rho with an autoregressive correlation structure. we then generate the "non-normalized" data w_i for each subject from multivariate normal distribution with covariance X.Sigma and mean determined by add.on and gamma. Each w_i is a vector of length p. Finally, the compositional covariates are obtained as

x_{ij}=exp(w_{ij})/∑_{k=1}^{p}exp(w_{ik}),

for each subject i=1,...,n and component j=1,...,p.

Value

A list containing:

y

a n-vector of the simulated response

X.comp

a matrix of the simulated compositional predictors of dimension n*p

Z

a matrix of the log-transformed compositional predictors

Zc

a matrix of the simulated covariates

intercept

whether an intercept is included

beta

the true coefficient vector

Author(s)

Zhe Sun and Kun Chen

References

Lin, W., Shi, P., Peng, R. and Li, H. (2014) Variable selection in regression with compositional covariates, https://academic.oup.com/biomet/article/101/4/785/1775476. Biometrika 101 785-979.

Examples

p = 30
beta = c(1, -0.8, 0.6, 0, 0, -1.5, -0.5, 1.2)
beta = c( beta, rep(0, times = p - length(beta)) )
Data = comp_Model(n = 50, p = p, intercept = FALSE,
                  rho = 0.2, sigma = 0.5, gamma  = 0.5, add.on = 1:5,
                  beta = beta)


[Package Compack version 0.1.0 Index]