Mantid
Loading...
Searching...
No Matches
Statistics.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2010 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9#include "MantidKernel/DllConfig.h"
10#include <vector>
11
12namespace Mantid {
13namespace Kernel {
14namespace Math {
19} // namespace Math
20
25struct Statistics {
27 double minimum;
29 double maximum;
31 double mean;
33 double median;
36};
37
40 enum Flag {
41 SortedData = 1, // is the data sorted?
42 Mean = 2, // calculate the mean
43 UncorrectedStdDev = 4, // calculate the s.d. using N dofs
44 CorrectedStdDev = 8, // calculate the s.d. using N-1 dofs
45 Median = 16, // calculate the median
47 };
48};
49
52struct Rfactor {
54 double Rwp;
56 double Rp;
58 Rfactor(double rwp, double rp) : Rwp(rwp), Rp(rp) {}
60 Rwp = -1.0;
61 Rp = -1.0;
62 }
63};
64
66template <typename TYPE>
67Statistics getStatistics(const std::vector<TYPE> &data, const unsigned int flags = StatOptions::AllStats);
69template <typename TYPE> std::vector<double> getZscore(const std::vector<TYPE> &data);
70template <typename TYPE>
71std::vector<double> getWeightedZscore(const std::vector<TYPE> &data, const std::vector<TYPE> &weights);
73template <typename TYPE> std::vector<double> getModifiedZscore(const std::vector<TYPE> &data);
75Rfactor MANTID_KERNEL_DLL getRFactor(const std::vector<double> &obsI, const std::vector<double> &calI,
76 const std::vector<double> &obsE);
77
79template <typename TYPE>
80std::vector<double> getMomentsAboutOrigin(const std::vector<TYPE> &x, const std::vector<TYPE> &y,
81 const int maxMoment = 3);
83template <typename TYPE>
84std::vector<double> getMomentsAboutMean(const std::vector<TYPE> &x, const std::vector<TYPE> &y,
85 const int maxMoment = 3);
86} // namespace Kernel
87} // namespace Mantid
StatisticType
Maps a "statistic" to a number.
Definition: Statistics.h:18
std::vector< double > getModifiedZscore(const std::vector< TYPE > &data)
Return the modified Z score values for a dataset.
Definition: Statistics.cpp:135
Statistics getStatistics(const std::vector< TYPE > &data, const unsigned int flags=StatOptions::AllStats)
Return a statistics object for the given data set.
Definition: Statistics.cpp:167
std::vector< double > getZscore(const std::vector< TYPE > &data)
Return the Z score values for a dataset.
Definition: Statistics.cpp:81
std::vector< double > getMomentsAboutMean(const std::vector< TYPE > &x, const std::vector< TYPE > &y, const int maxMoment=3)
Return the first n-moments of the supplied data.
Definition: Statistics.cpp:351
std::vector< double > getWeightedZscore(const std::vector< TYPE > &data, const std::vector< TYPE > &weights)
There are enough special cases in determining the Z score where it useful to put it in a single funct...
Definition: Statistics.cpp:102
std::vector< double > getMomentsAboutOrigin(const std::vector< TYPE > &x, const std::vector< TYPE > &y, const int maxMoment=3)
Return the first n-moments of the supplied data.
Definition: Statistics.cpp:295
Rfactor MANTID_KERNEL_DLL getRFactor(const std::vector< double > &obsI, const std::vector< double > &calI, const std::vector< double > &obsE)
Return the R-factors (Rwp) of a diffraction pattern data.
Definition: Statistics.cpp:229
Helper class which provides the Collimation Length for SANS instruments.
R factor for powder data analysis.
Definition: Statistics.h:52
Rfactor(double rwp, double rp)
Foos(int a, int b) : a(a), b(b) {}.
Definition: Statistics.h:58
Controls the computation of statisical data.
Definition: Statistics.h:39
Simple struct to store statistics.
Definition: Statistics.h:25
double mean
Mean value.
Definition: Statistics.h:31
double median
Median value.
Definition: Statistics.h:33
double minimum
Minimum value.
Definition: Statistics.h:27
double maximum
Maximum value.
Definition: Statistics.h:29
double standard_deviation
standard_deviation of the values
Definition: Statistics.h:35