rMNB: Generating Multivariate Negative Binomial Data

View source: R/rMNB.R

rMNBR Documentation

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)

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.

Value

Generated response (Y_ij)

Author(s)

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

Examples


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)


carrascojalmar/MNB documentation built on May 15, 2022, 4:41 a.m.