R/para.bootstrap.R

Defines functions para.bootstrap

Documented in para.bootstrap

#' Parameteric bootstrap
#' @export
para.bootstrap <- function(h2, x, n.sub, h2.method = GCTA.rr, target = c("beta2","h2")[1]){
  x <- std.fn(x)
  K <- x %*% t(x) * 1/ncol(x)
  In <- diag(nrow(x))
  Vh <- h2*K + (1-h2)*In
  res.tmp <- numeric(n.sub)
  set.seed(1234)
  for(i in 1:n.sub){
  y.bs <- MASS::mvrnorm(n = 1, mu = numeric(nrow(x)), Sigma = Vh)
  res.tmp[i] <- h2.method(x = x, y = y.bs, target = target)
  }
  res.tmp
}
wal615/prime.total.effect documentation built on April 29, 2020, 2:05 p.m.