veemm: veemm

Description Usage Arguments Author(s) References Examples

Description

Computes the mad-median type of variance component estimator.

Usage

1
veemm(ehat, center)

Arguments

ehat
center

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
##---- 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 (ehat, center) 
{
    numc <- max(center)
    meds <- c(0)
    ehatp <- ehat
    n <- length(ehat)
    for (i in 1:numc) {
        ehatc <- ehat[center == i]
        meds[i] <- median(ehatc)
    }
    reff <- meds
    sigb2 <- mad(meds)^2
    xmat <- model.matrix(~as.factor(center) - 1)
    ehatp <- ehat - xmat %*% meds
    sige2 <- mad(ehatp)^2
    sigt2 <- sigb2 + sige2
    rho <- sigb2/sigt2
    vc <- c(sigt2, sigb2, sige2, rho)
    list(vc = vc, reff = reff)
  }

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