SKAT_Get_TruncatedNormal: Get Truncated Normal MLEs

Usage Arguments Examples

View source: R/SKAT_Get_TruncatedNormal.R

Usage

1
SKAT_Get_TruncatedNormal(n, mu, sigma, c1, c2, nSet, nUpper = n/2)

Arguments

n
mu
sigma
c1
c2
nSet
nUpper

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
##---- 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 (n, mu, sigma, c1, c2, nSet, nUpper = n/2) 
{
    prob1 <- 1 - pnorm(c1, mean = mu, sd = sigma)
    prob2 <- pnorm(c2, mean = mu, sd = sigma)
    prob <- prob1/(prob1 + prob2)
    temp.b <- rbinom(n * nSet, 1, rep(prob, nSet))
    lower = rep(-10^5, n * nSet) * (1 - temp.b) + c1
    upper = rep(10^5, n * nSet) * temp.b + c2
    re <- rtnorm(n * nSet, mean = mu, sd = sigma, lower = lower, 
        upper = upper)
    re.M <- matrix(re, ncol = nSet, byrow = FALSE)
    cutoff <<- cbind(lower, upper, temp.b, mu)
    rm(re)
    rm(lower)
    rm(upper)
    return(re.M)
  }

lin-lab/CEPSKAT documentation built on May 29, 2019, 3:41 a.m.