1 | SEML(Z, thetaMLE)
|
Z |
|
thetaMLE |
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 32 | ##---- 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 (Z, thetaMLE)
{
n = nrow(Z)
p = ncol(Z)
ps = p * (p + 1)/2
q = ps
zbar = MeanCov(Z)$zbar
S = MeanCov(Z)$S
Dup = Dp(p)
InvS = solve(S)
W = 0.5 * t(Dup) %*% (InvS %x% InvS) %*% Dup
OmegaInf = solve(W)
S12 = matrix(0, p, ps)
S22 = matrix(0, ps, ps)
for (i in 1:n) {
zi0 = Z[i, ] - zbar
difi = zi0 %*% t(zi0) - S
vdifi = vech(difi)
S12 = S12 + zi0 %*% t(vdifi)
S22 = S22 + vdifi %*% t(vdifi)
}
OmegaSW = S22/n
SEinf = getSE(thetaMLE, OmegaInf, n)
SEsw = getSE(thetaMLE, OmegaSW, n)
Results = list(inf = SEinf, sand = SEsw)
return(Results)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.