libSUFR
a LIBrary of Some Useful Fortran Routines
All Classes Namespaces Files Functions Variables Pages
statistics.f90 File Reference

(libSUFR version 0.7.8, revision 407, hash 01069b8, 2025-03-02)

Procedures to compute statistics. More...

Go to the source code of this file.

Modules

module  sufr_statistics
 Procedures to do statistics.
 

Functions/Subroutines

real(double) function sufr_statistics::median (data, mask)
 Compute the median of a data array.
 
real function sufr_statistics::median_sp (data, mask)
 Compute the median of a data array - single-precision wrapper for median()
 
real(double) function sufr_statistics::mean (data, mask)
 Compute the mean of a data array.
 
real function sufr_statistics::mean_sp (data, mask)
 Compute the mean of a data array - single-precision wrapper for mean()
 
real(double) function sufr_statistics::mean_weight (data, wgts, mask)
 Compute the weighted mean of a data array.
 
real(double) function sufr_statistics::stdev (data, dmean, mask, var)
 Compute the standard deviation of a data array with mean 'mean'.
 
real function sufr_statistics::stdev_sp (data, mean, mask)
 Compute the standard deviation of a data array with mean 'mean' - single-precision wrapper for stDev()
 
real(double) function sufr_statistics::stdev_weight (data, wgts, wmean, mask)
 Compute the weighted standard deviation of a data array with weighted mean 'wMean'.
 
pure subroutine sufr_statistics::mean_var_running (mean, var, data, num, stdev)
 Compute a running mean and variance by adding a data point and the data point number to existing values. If num=1, initialise. Note that mean and var are I/O variables and cannot be dummy variables or values. Num must be accurate, and increased by one between calls by the user. Optionally, return the standard deviation.
 
subroutine sufr_statistics::prob_range (data, range, llim, ulim, mask)
 Find a given probability range for a data array - the narrowest range that contains a given fraction of data points.
 
subroutine sufr_statistics::prob_range_sp (data, range, llim, ulim, mask)
 Find a given probability range for a data array - the narrowest range that contains a given fraction of data points - single-precision wrapper for prob_range()
 
pure integer function sufr_statistics::determine_nbin_1d (npoints)
 Roughly estimate the number of 1D bins needed, from the number of data points.
 
subroutine sufr_statistics::bin_data_1d (xdat, nbin, norm, mode, cumul, xmin, xmax, xbin, ybin)
 Bin data in 1D bins by counting the number of data points in each bin.
 
subroutine sufr_statistics::bin_data_1d_sp (xdat, nbin, norm, mode, cumul, xmin, xmax, xbin, ybin)
 Bin data in 1D bins by counting the number of data points in each bin - single-precision wrapper for bin_data_1d()
 
pure subroutine sufr_statistics::histogram_1d_onthefly (xdat, nbin, mode, cumul, xmin, xmax, xbin, ybin, init, weight)
 Create a 1D histogram on the fly (point by point). Bin data points by computing the bin they should be in.
 
subroutine sufr_statistics::bin_data_2d (xdat, ydat, norm, nxbin, nybin, xmin, xmax, ymin, ymax, z, tr, weights)
 Bin data in 2 dimensions - computing the bin number rather than searching for it is ~10x faster.
 
subroutine sufr_statistics::bin_data_2d_sp (xdat, ydat, norm, nxbin, nybin, xmin, xmax, ymin, ymax, z, tr, weights)
 Bin data in 2 dimensions - single-precision wrapper for bin_data_2d()
 
subroutine sufr_statistics::histogram_2d_onthefly (xdat, ydat, nxbin, nybin, xmin, xmax, ymin, ymax, z, init, weight, tr)
 Bin data in 2 dimensions - computing the bin number rather than searching for it is ~10x faster.
 
pure integer(long) function sufr_statistics::faculty_i (n)
 Compute the faculty of an integer, returning a long integer.
 
pure real(double) function sufr_statistics::faculty (n)
 Compute the faculty of an integer, returning a double-precision real.
 
pure real(double) function sufr_statistics::binom_coeff (n, k)
 Compute the binomial coefficient of n and k.
 
pure real(double) function sufr_statistics::binom_prob (n, k, p)
 Compute the binomial probability of n and k, and probability p.
 
pure real(double) function sufr_statistics::binom_cumul_prob (n, k, p)
 Compute the cumulative binomial probability of n and k OR FEWER, and probability p.
 
pure real(double) function sufr_statistics::poisson_prob (k, lambda)
 Compute the Poisson probability of EXACTLY k events occurring in a fixed interval for a known average rate lambda, and independently of the time since the last event: P = λ^k e^-λ / k!
 
pure real(double) function sufr_statistics::poisson_prob_cumul (k, lambda)
 Compute the cumulative Poisson probability of k OR FEWER events occurring in a fixed interval for a known average rate lambda, and independently of the time since the last event: P = Σ(i=0,k) λ^i e^-λ / i!
 
real(double) function sufr_statistics::correlation (data1, data2)
 Compute the normalised correlation between two data series.
 

Detailed Description

Procedures to compute statistics.

Definition in file statistics.f90.