R/rwishart.R

#Internal Function

rwishart <- function (df, p) 
{
    X <- matrix(0, p, p)
    diag(X) <- sqrt(rchisq(p, df:(df - p + 1)))
    if (p > 1) {
        pseq <- 1:(p - 1)
        X[rep(p * pseq, pseq) + unlist(lapply(pseq, seq))] = rnorm(p * 
            (p - 1)/2)
    }
    crossprod(X)
}

Try the tolerance package in your browser

Any scripts or data that you put into this service are public.

tolerance documentation built on May 29, 2024, 7:38 a.m.