Description Usage Arguments Value Author(s) Examples
Generate binary response data for a given marginal mean and association model. Association models include those with a random intercept and/or a first-order time lag.
1 2 3 |
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. |
Yname |
a character string of the name of new binary variable; default=Y |
This function returns the data object augmented with a binary response vector named Yname.
Jonathan Schildcrout and Nathaniel Mercaldo
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ## Not run:
set.seed(1)
N = 1500
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, .25, .25, .1), sigma=1, gamma=1, id=id, data=data, q=20,
Yname = "binY")
mod_mtlv = mm(binY~time*Xe,lv.formula=~1, t.formula=~1, data=newdata,id=id, q=20)
summary(mod_mtlv)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.