View source: R/SKAT_TruncatedNormalCEP_Get_Moment.R
1 | SKAT_TruncatedNormalCEP_Get_Moment(c1, c2, sigma, Xa)
|
c1 |
|
c2 |
|
sigma |
|
Xa |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ##---- 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 (c1, c2, sigma, Xa)
{
a1 <- (c1 - Xa)/sigma
a2 <- (c2 - Xa)/sigma
f1 <- dnorm(a1)
f2 <- dnorm(a2)
F1 <- pnorm(a1)
F2 <- pnorm(a2)
f12 <- f2 - f1
F12 <- F2 + 1 - F1
M <- f12/F12 * sigma
V <- (a2 * f2 - a1 * f1)/F12 + M^2/sigma^2
W <- (1 - V) * sigma^2
Mu <- Xa - M
return(list(M = M, V = V, W = W, Mu = Mu))
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.