mvb.simu: generate multivariate Bernoulli simulated data

Description Usage Arguments Details Value See Also Examples

Description

for given coefficients and design matrix, generate the corresponding responses according multivariate Bernoulli model

Usage

1

Arguments

coefficients

coefficients matrix, number of columns should be less than 2^K.

x

design matrix.

K

number of outcomes for the model.

offset

non-penalized terms in coefficients, corresponding to a unit column in design matrix, which is generated automaticly.

Details

The response variables are simulated according to cononical link function of multivariate Bernoulli model with coefficients speicified.

Value

response

matrix for outcomes, with dimension nobs times K.

beta

expanded coefficients from input argument coefficients and offset.

See Also

mvbfit, mvblps

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# fit a simple MVB log-linear model
n <- 1000
p <- 5
kk <- 2
tt <- NULL
alter <- 1
for (i in 1:kk) {
  vec <- rep(0, p)
  vec[i] <- alter
  alter <- alter * (-1)
  tt <- cbind(tt, vec)
}
tt <- 1.5 * tt
tt <- cbind(tt, c(rep(0, p - 1), 1))

x <- matrix(rnorm(n * p, 0, 4), n, p)
res <- mvb.simu(tt, x, K = kk, rep(.5, 2))
fitMVB <- mvbfit(x, res$response, output = 1)

Example output

Loading required package: Rcpp
Loading required package: RcppArmadillo
fit started
iteration 0 gpnorm = 2.47016
iteration 8 gpnorm = 2.26266e-08
*** Converged ***

MVB documentation built on May 2, 2019, 3:06 a.m.