normalMoment {hpa} | R Documentation |
Calculate k-th order moment of normal distribution
Description
This function recursively calculates k-th order moment of normal distribution.
Usage
normalMoment(
k = 0L,
mean = 0,
sd = 1,
return_all_moments = FALSE,
is_validation = TRUE,
is_central = FALSE,
diff_type = "NO"
)
Arguments
k |
non-negative integer moment order. |
mean |
numeric expected value. |
sd |
positive numeric standard deviation. |
return_all_moments |
logical; if |
is_validation |
logical value indicating whether function input
arguments should be validated. Set it to |
is_central |
logical; if |
diff_type |
string value indicating the type of the argument
the moment should be differentiated respect to.
Default value is |
Details
This function estimates k
-th order moment of normal
distribution which mean equals to mean
and standard deviation
equals to sd
.
Note that parameter k
value automatically converts
to integer. So passing non-integer k
value will not cause
any errors but the calculations will be performed for rounded
k
value only.
Value
This function returns k
-th order moment of
normal distribution which mean equals to mean
and standard deviation
is sd
. If return_all_moments
is TRUE
then see this
argument description above for output details.
Examples
## Calculate 5-th order moment of normal random variable which
## mean equals to 3 and standard deviation is 5.
# 5-th moment
normalMoment(k = 5, mean = 3, sd = 5)
# (0-5)-th moments
normalMoment(k = 5, mean = 3, sd = 5, return_all_moments = TRUE)
# 5-th moment derivative respect to mean
normalMoment(k = 5, mean = 3, sd = 5, diff_type = "mean")
# 5-th moment derivative respect to sd
normalMoment(k = 5, mean = 3, sd = 5, diff_type = "sd")