trim(3f) - [M_datapac:STATISTICS] computes the sample trimmed mean of the data in the input vector X.
Synopsis
Description
Input Arguments
Output Arguments
Examples
Author
Maintainer
License
References
SUBROUTINE TRIM(X,N,P1,P2,Iwrite,Xtrim)
REAL(kind=wp),intent(in) :: X(:) INTEGER,intent(in) :: N REAL(kind=wp),intent(in) :: P1 REAL(kind=wp),intent(in) :: P2 INTEGER,intent(in) :: Iwrite REAL(kind=wp),intent(out) :: Xtrim
TRIM(3f) computes the sample trimmed mean of the data in the input vector X.The trimming is such that the lower 100*P1 % of the data is trimmed off and the upper 100*P2 % of the data is trimmed off.
X The vector of (unsorted or sorted) observations. N The integer number of observations in the vector X. The maximum allowable value of N for this subroutine is 15000. P1 The value (between 0.0 and 1.0) which defines what fraction of the lower order statistics is to be trimmed off before computing the trimmed mean. P1 should be non-negative. P1 should be smaller than 1.0 . P2 The value (between 0.0 and 1.0) which defines what fraction of the upper order statistics is to be trimmed off before computing the trimmed mean. P2 should be non-negative. P2 should be smaller than 1.0. The sum of P1 and P2 should be smaller than 1.0. IWRITE An integer flag code which (if set to 0) will suppress the printing of the sample trimmed mean as it is computed; or (if set to some integer value not equal to 0), like, say, "1" will cause the printing of the sample trimmed mean at the time it is computed.
XTRIM The value of the computed sample trimmed mean where 100*P1 % of the smallest and 100*P2 % of the largest ordered observations have been trimmed away before computing the mean of the remaining observations in the middle.
Sample program:
program demo_trim use M_datapac, only : trim implicit none ! call trim(x,y) end program demo_trimResults:
The original DATAPAC library was written by James Filliben of the Statistical Engineering Division, National Institute of Standards and Technology.
John Urban, 2022.05.31
CC0-1.0
o David, Order Statistics, 1970, pages 126-130, 136. o Crow and Siddiqui, Robust Estimation of Location, Journal of the American Statistical Association, 1967, pages 357, 387. o Filliben, Simple and Robust Linear Estimation of the Location Parameter of a Symmetric Distribution (Unpublished PH.D. Dissertation, Princeton University, 1969).
Nemo Release 3.1 | trim (3) | February 23, 2025 |