Learn R Programming

MNB (version 1.2.0)

rMNB: Generating Multivariate Negative Binomial Data

Description

It simulates a multivariate response variable, \(Y_{ij}\), that is jth measurement taken on the ith subject or cluster, i = 1,...,n and j= 1,...,mi.

Usage

rMNB(n, mi, formula, p.fix)

Value

Generated response (\(Y_{ij}\))

Arguments

n

Length of the sample.

mi

replicates on the ith subject or cluster.

formula

The structure matrix of covariates of dimension n x p (in models that include an intercept x should contain a column of ones)

p.fix

Vector of theoretical regression parameters of length p.

Author

Jalmar M F Carrasco <carrascojalmar@gmail.com>, Cristian M Villegas Lobos <master.villegas@gmail.com> and Lizandra C Fabio <lizandrafabio@gmail.com>

Examples

Run this code

n <- 100
mi <- 3
x1 <- rep(rnorm(n,0,1),each=mi)
x2 <- rep(c(0,1),each=150)
p.fix <- c(10,2.0,0.5,1)

#generating a sample
sample.ex <- rMNB(n=n,mi=mi,formula=~x1+x2, p.fix=p.fix)
head(sample.ex)

Run the code above in your browser using DataLab