# NOT RUN {
## Calculate 5-th order moment of three truncated normal random
## variables (x1, x2, x3) which mean is 5 and standard deviation is 3.
## These random variables truncation points are given
## as follows:-1<x1<1, 0<x2<2, 1<x3<3.
k <- 3
x_lower <- c(-1, 0, 1, -Inf, -Inf)
x_upper <- c(1, 2 , 3, 2, Inf)
mean <- 3
sd <- 5
# get the moments
truncatedNormalMoment(k, x_lower, x_upper, mean, sd)
# get matrix of (0-5)-th moments (columns) for each variable (rows)
truncatedNormalMoment(k, x_lower, x_upper,
mean, sd,
return_all_moments = TRUE)
# get the moments derivatives respect to mean
truncatedNormalMoment(k, x_lower, x_upper,
mean, sd,
diff_type = "mean")
# get the moments derivatives respect to standard deviation
truncatedNormalMoment(k, x_lower, x_upper,
mean, sd,
diff_type = "sd")
# }
Run the code above in your browser using DataLab