gencs2: gencs2

Description Usage Arguments Author(s) References Examples

Description

Simulator for a GEE model.

Usage

1
gencs2(vecni, vc, beta, xmat, itypee = 1, itypeb = 1)

Arguments

vecni
vc
beta
xmat
itypee
itypeb

Author(s)

Joseph W. McKean

References

Kloke and McKean (2014), Nonparametrics Using R, Boca Raton: Chapman-Hall.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (vecni, vc, beta, xmat, itypee = 1, itypeb = 1) 
{
    numc <- length(vecni)
    n <- sum(vecni)
    center <- rep(0, n)
    ind <- rep(0, n)
    errs <- rep(0, n)
    i1 <- 1
    i2 <- 0
    for (j in 1:numc) {
        if (itypeb == 1) {
            bj <- rnorm(1, 0, sqrt(vc[1]))
        }
        i2 <- i2 + vecni[j]
        ni <- vecni[j]
        ni2 <- floor(ni/2)
        center[i1:i2] <- rep(j, ni)
        if (itypee == 1) {
            ei <- rnorm(ni, 0, sqrt(vc[2]))
        }
        errs[i1:i2] <- ei + bj
        i1 <- i1 + ni
    }
    y <- xmat %*% beta + errs
    list(y = y, center = center)
  }

kloke/rbgee documentation built on May 20, 2019, 12:34 p.m.