GenBinaryY {binaryMM}R Documentation

Generate binary response data from a Marginalized Transition and Latent Variable Model

Description

Generate binary response data from a Marginalized Transition and Latent Variable Model

Usage

GenBinaryY(
  mean.formula,
  lv.formula = NULL,
  t.formula = NULL,
  beta = NULL,
  sigma = NULL,
  gamma = NULL,
  id,
  data,
  q = 10
)

Arguments

mean.formula

Right hand side of mean model formula

lv.formula

Latent variable model formula (right hand side only)

t.formula

Transition model formula (right hand side only)

beta

a vector of values for mean.formula

sigma

a vector of values for the latent variable portion of the association model (else NULL)

gamma

a vector of values for the transition porition of the association model (else NULL)

id

a vector of cluster identifiers (it should be the same length nrow(data))

data

a required data frame

q

a scalar to denote the number of quadrature points used for GH numerical integration

Value

The function returns a binary response vector.

Examples


set.seed(1)
N      = 100
nclust = sample( seq(10,10), N, replace=TRUE)
id     = rep(seq(N), nclust)
Xe     = rep(rbinom(N,size=1,prob=.5), nclust) # binary exposure
time   = unlist( sapply( as.list(nclust), function(ZZ) seq(ZZ)-1 ) )
data   = data.frame(id, time, Xe)
data   = data[order(data$id, data$time),]
newdata = GenBinaryY(mean.formula=~time*Xe, lv.formula=~1, t.formula=~1,
beta=c(-2.5, 0.25, 0.25, 0.1), sigma=1, gamma=1, id=id, data=data, q=20)


[Package binaryMM version 0.1.1 Index]