FORCES
FORtran lib for Comp. Env. Sys.
|
Transform a positive dataset with a Box-Cox power transformation. More...
Public Member Functions | |
real(sp) function, dimension(size(x)) | boxcox_sp (x, lmbda, mask) |
real(dp) function, dimension(size(x)) | boxcox_dp (x, lmbda, mask) |
Transform a positive dataset with a Box-Cox power transformation.
Calculate Box-Cox power transformed values given the original values and the exponent lambda.
\[ w_\text{Box-Cox}(x) = \begin{cases} \frac{x^\lambda - 1}{\lambda}&\text{, if }\lambda \neq 0 \\ \ln{x}&\text{, if }\lambda = 0 \end{cases} \]
If an optional mask is given, then the Box-Cox transformation is only performed on those locations that correspond to true values in the mask.
\(x\) can be single or double precision. The result will have the same numerical precision. \(x\) can be scalar or vector.
Example
See also test folder for a detailed example, "pf_tests/test_mo_boxcox".
[in] | real(sp/dp) :: x | Scalar/1D-array with input numbers (`>0.`) |
[in] | real(sp/dp) :: lmbda | Exponent power of Box-Cox transform (`>= 0.`) |
[in] | logical, optional :: mask | Scalar/1D-array of logical values with size(x) . If present, only those locations in vec corresponding to the true values in mask are used. |
real(sp/dp) :: boxcox | Power transformed values (at mask=.true. ) |
Definition at line 66 of file mo_boxcox.f90.
real(dp) function, dimension(size(x)) mo_boxcox::boxcox::boxcox_dp | ( | real(dp), dimension(:), intent(in) | x, |
real(dp), intent(in) | lmbda, | ||
logical, dimension(:), intent(in), optional | mask | ||
) |
Definition at line 154 of file mo_boxcox.f90.
real(sp) function, dimension(size(x)) mo_boxcox::boxcox::boxcox_sp | ( | real(sp), dimension(:), intent(in) | x, |
real(sp), intent(in) | lmbda, | ||
logical, dimension(:), intent(in), optional | mask | ||
) |
Definition at line 122 of file mo_boxcox.f90.