C Library Functions  - mean (3)

NAME

mean(3f) - [M_datapac:STATISTICS] compute the sample mean of a data vector

CONTENTS

Synopsis
Description
Input Arguments
Output Arguments
Examples
Author
Maintainer
License
References

SYNOPSIS

subroutine mean(X,N,Iwrite,Xmean)

       real(kind=wp),intent(in)  :: X(:)
       integer,intent(in)        :: N
       integer,intent(in)        :: Iwrite
       real(kind=wp),intent(out) :: Xmean

DESCRIPTION

MEAN(3f) computes the sample mean of the data in the input vector X.

The sample mean = (sum of the observations)/n.

For a data set, the arithmetic mean, also known as arithmetic average, is a measure of central tendency of a finite set of numbers: specifically, the sum of the values divided by the number of values. If the data set were based on a series of observations obtained by sampling from a statistical population, the arithmetic mean is the sample mean.

INPUT ARGUMENTS

X The vector of (unsorted or sorted) observations.
N The integer number of observations in the vector X.
IWRITE An integer flag code which (if set to 0) will suppress the printing of the sample 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 mean at the time it is computed.

OUTPUT ARGUMENTS

XMEAN The value of the computed sample mean.

EXAMPLES

Sample program:

   program demo_mean
   use M_datapac, only : mean, label
   implicit none
   real :: sp_mean
   double precision :: dp_mean
      call label(’mean’)
      call mean([4.0, 36.0, 45.0, 50.0, 75.0], 5, 1, sp_mean)
      write(*,*)sp_mean,sp_mean==42.0
      call mean([4.0d0, 36.0d0, 45.0d0, 50.0d0, 75.0d0], 5, 1, dp_mean)
      write(*,*)dp_mean,dp_mean==42.0
   end program demo_mean

Results:

AUTHOR

The original DATAPAC library was written by James Filliben of the Statistical Engineering Division, National Institute of Standards and Technology.

MAINTAINER

John Urban, 2022.05.31

LICENSE

CC0-1.0

REFERENCES

o Kendall and Stuart, The Advanced Theory of Statistics, Volume 2, Edition 1, 1961, page 4.
o Mood and Grable, Introduction to the Theory of Statistics, Edition 2, 1963, page 146.
o Dixon and Massey, Introduction to Statistical Analysis, Edition 2, 1957, page 14.


Nemo Release 3.1 mean (3) July 22, 2023
Generated by manServer 1.08 from b1097092-f71a-4a70-a7c4-ac9c72c17fd6 using man macros.