rMNR: Simulate Multivariate Normal Data

Description Usage Arguments Value Examples

View source: R/DataGen.R

Description

Function to simulate outcomes from a multivariate normal regression model.

Usage

1
rMNR(X, b, S)

Arguments

X

List of design matrices, one for each outcome.

b

List of regression coefficients, one for each outcome.

S

Outcome covariance structure.

Value

Numeric n\times k matrix, where n is the number of rows in each design matrix, and k is the number of rows in the covariance structure.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## Not run: 
set.seed(100);
# Observations
n = 1e3;
## Design matrices
X1 = cbind(1,matrix(rnorm(2*n),nrow=n));
colnames(X1) = c("int",paste0("x0",seq(1:2)));
X2 = cbind(1,matrix(rnorm(3*n),nrow=n));
colnames(X2) = c("int",paste0("x1",seq(1:3)));
X3 = cbind(1,matrix(rnorm(4*n),nrow=n));
colnames(X3) = c("int",paste0("x2",seq(1:4)));
X = list(X1,X2,X3);
# Target Parameter
b1 = c(-1,0.1,-0.1);
b2 = c(1,-0.1,0.1,0);
b3 = c(0,0.1,-0.1,0.1,-0.1);
b = list(b1,b2,b3);
# Exchangeable covariance structure
S = array(0.5,dim=c(3,3)) + 0.5*diag(3);
# Generate data
Y = rMNR(X=X,b=b,S=S);

## End(Not run)

zrmacc/MNR documentation built on May 17, 2019, 8:47 p.m.