Description Usage Arguments Author(s) References Examples
Computes AR(1) estimate for workink covariance matrix. Structure should be set at "AR". See Section 8.6.3 of Kloke and McKean (2014).
1 | veear1m(ehat, center, scores)
|
ehat |
|
center |
|
scores |
Joseph W. McKean
Kloke and McKean (2014), Nonparametrics Using R, Boca Raton: Chapman-Hall.
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 (ehat, center, scores)
{
numc <- max(center)
n <- length(ehat)
rho <- rep(0, numc)
sig <- rep(0, numc)
for (i in 1:numc) {
ehatc <- ehat[center == i]
ni <- length(ehatc)
elp1 <- ehatc[2:ni]
elm1 <- ehatc[1:(ni - 1)]
fiti <- rfit(elp1 ~ elm1, scores = scores)
rho[i] <- fiti$coef[2]
sig[i] <- mad(fiti$resid)
}
rhomed <- median(rho)
sigmed2 <- median(sig)^2
if (rhomed > 0.95) {
rhomed <- 0.95
}
if (rhomed < -0.95) {
rhomed <- -0.95
}
vc <- c(sigmed2, rhomed)
return(vc)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.