R/mice_multilevel_draw_rnorm1.R

Defines functions mice_multilevel_draw_rnorm1

## File Name: mice_multilevel_draw_rnorm1.R
## File Version: 0.05

########################################################################
# draw a vector of random variables using a Cholesky decomposition
# input mean vector and covariance matrix
mice_multilevel_draw_rnorm1 <- function( mu, Sigma){
    #----
    #b.star <- b.star + as.vector( t(chol(vcov(fit))) %*% rnorm(length(b.star)) )
    NP <- length(mu)
    res <- mu + as.vector( t( chol(Sigma) %*% stats::rnorm(NP) ) )
    return(res)
}

Try the miceadds package in your browser

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

miceadds documentation built on May 29, 2024, 11:05 a.m.