mulgreg:

Usage Arguments Examples

Usage

1
mulgreg(x, y, cov.fun = rmba)

Arguments

x
y
cov.fun

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
32
33
##---- 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 (x, y, cov.fun = rmba) 
{
    library(MASS)
    if (!is.matrix(y)) 
        stop("y is not a matrix")
    X <- cbind(x, y)
    X <- elimna(X)
    qy <- ncol(y)
    qx <- ncol(x)
    qxp1 <- qx + 1
    tqyqx <- qy + qx
    y <- X[, qxp1:tqyqx]
    locscat <- cov.fun(X)
    sig <- locscat$cov
    mu <- locscat$center
    sigxx <- sig[1:qx, 1:qx]
    sigxy <- sig[1:qx, qxp1:tqyqx]
    sigyy <- sig[qxp1:tqyqx, qxp1:tqyqx]
    Bhat <- solve(sigxx) %*% sigxy
    sige <- sigyy - t(Bhat) %*% sigxx %*% Bhat
    sige.inv <- solve(sige)
    Ahat <- t(mu[qxp1:tqyqx] - t(Bhat) %*% mu[1:qx])
    resL <- matrix(nrow = nrow(X), ncol = qy)
    for (i in 1:nrow(X)) resL[i, ] <- y[i, ] - t(Bhat) %*% X[i, 
        1:qx]
    for (j in 1:qy) resL[, j] <- resL[, j] - Ahat[j]
    list(coef = rbind(Ahat, Bhat), residuals = resL)
  }

musto101/wilcox_R documentation built on May 23, 2019, 10:52 a.m.