![]() |
Visual Servoing Platform version 3.7.0
|
#include <vpStatisticalTestSigma.h>
Public Types | |
| enum | vpMeanDriftType { MEAN_DRIFT_NONE = 0 , MEAN_DRIFT_DOWNWARD = 1 , MEAN_DRIFT_UPWARD = 2 , MEAN_DRIFT_BOTH = 3 , MEAN_DRIFT_COUNT = 4 , MEAN_DRIFT_UNKNOWN = MEAN_DRIFT_COUNT } |
| typedef enum vpStatisticalTestAbstract::vpMeanDriftType | vpMeanDriftType |
Public Member Functions | |
| vpStatisticalTestSigma (const float &h=3.f, const unsigned int &nbSamplesForStats=30) | |
| vpStatisticalTestSigma (const float &h, const float &mean, const float &stdev) | |
| virtual float | getSignal () const |
| void | init (const float &h=3.f, const unsigned int &nbSamplesForStats=30) |
| void | init (const float &h, const float &mean, const float &stdev) |
| void | getLimits (float &limitDown, float &limitUp) const |
| float | getMean () const |
| float | getStdev () const |
| void | init () |
| void | setMinStdev (const float &stdevmin) |
| void | setNbSamplesForStat (const unsigned int &nbSamples) |
| vpMeanDriftType | testDownUpwardMeanDrift (const float &signal) |
| vpMeanDriftType | testDownwardMeanDrift (const float &signal) |
| vpMeanDriftType | testUpwardMeanDrift (const float &signal) |
Static Public Member Functions | |
| static std::string | vpMeanDriftTypeToString (const vpMeanDriftType &type) |
| static vpMeanDriftType | vpMeanDriftTypeFromString (const std::string &name) |
| static std::string | getAvailableMeanDriftType (const std::string &prefix="<", const std::string &sep=" , ", const std::string &suffix=">") |
| static void | print (const vpMeanDriftType &type) |
Protected Member Functions | |
| virtual void | computeLimits () |
| virtual vpMeanDriftType | detectDownwardMeanDrift () VP_OVERRIDE |
| virtual vpMeanDriftType | detectUpwardMeanDrift () VP_OVERRIDE |
| virtual bool | updateStatistics (const float &signal) VP_OVERRIDE |
| virtual void | updateTestSignals (const float &signal) VP_OVERRIDE |
Protected Attributes | |
| float | m_h |
| float | m_signal |
| bool | m_areStatisticsComputed |
| float | m_count |
| float | m_limitDown |
| float | m_limitUp |
| float | m_mean |
| unsigned int | m_nbSamplesForStatistics |
| float * | m_s |
| float | m_stdev |
| float | m_stdevmin |
| float | m_sumForMean |
Class that permits a simple test comparing the current value to the standard deviation of the signal.
Be
the signal to monitor,
and
the mean and standard deviation of this signal when it is "in control".
Be
a user-defined alarm factor.
A downward alarm is raised if: ![]()
An upward alarm is raised if: ![]()
is often set to 3 if we assume the
follows a normal distribution.
To detect only downward drifts of the input signal
use testDownwardMeanDrift().To detect only upward drifts in
use testUpwardMeanDrift(). To detect both, downward and upward drifts use testDownUpwardMeanDrift().
Tutorials
If you are interested in using Statistical Process Control methods, you may have a look at:
Definition at line 75 of file vpStatisticalTestSigma.h.
|
inherited |
Enum that indicates if a drift of the mean occurred.
|
inherited |
Enum that indicates if a drift of the mean occurred.
Definition at line 69 of file vpStatisticalTestAbstract.h.
| vpStatisticalTestSigma::vpStatisticalTestSigma | ( | const float & | h = 3.f, |
| const unsigned int & | nbSamplesForStats = 30 ) |
Construct a new vpStatisticalTestSigma object.
| [in] | h | The alarm factor applied to the standard deviation to compute the limits. |
| [in] | nbSamplesForStats | The number of samples to compute the statistics of the signal. |
Definition at line 83 of file vpStatisticalTestSigma.cpp.
References vpStatisticalTestAbstract::init(), m_h, and vpStatisticalTestAbstract::vpStatisticalTestAbstract().
Referenced by vpStatisticalTestShewhart::vpStatisticalTestShewhart(), and vpStatisticalTestShewhart::vpStatisticalTestShewhart().
| vpStatisticalTestSigma::vpStatisticalTestSigma | ( | const float & | h, |
| const float & | mean, | ||
| const float & | stdev ) |
Construct a new vpStatisticalTestSigma object.
| [in] | h | The alarm factor applied to the standard deviation to compute the limits. |
| [in] | mean | The expected mean of the signal. |
| [in] | stdev | The expected standard deviation of the signal. |
Definition at line 90 of file vpStatisticalTestSigma.cpp.
References vpStatisticalTestAbstract::init(), m_h, and vpStatisticalTestAbstract::vpStatisticalTestAbstract().
|
protectedvirtual |
Compute the upper and lower limits of the test signal.
Reimplemented in vpStatisticalTestShewhart.
Definition at line 42 of file vpStatisticalTestSigma.cpp.
References m_h, vpStatisticalTestAbstract::m_limitDown, vpStatisticalTestAbstract::m_limitUp, vpStatisticalTestAbstract::m_mean, and vpStatisticalTestAbstract::m_stdev.
Referenced by init(), and updateStatistics().
|
protectedvirtual |
Detects if a downward mean drift occurred.
Implements vpStatisticalTestAbstract.
Reimplemented in vpStatisticalTestShewhart.
Definition at line 49 of file vpStatisticalTestSigma.cpp.
References vpStatisticalTestAbstract::m_limitDown, m_signal, vpStatisticalTestAbstract::MEAN_DRIFT_DOWNWARD, and vpStatisticalTestAbstract::MEAN_DRIFT_NONE.
|
protectedvirtual |
Detects if an upward mean drift occurred on the mean.
Implements vpStatisticalTestAbstract.
Reimplemented in vpStatisticalTestShewhart.
Definition at line 59 of file vpStatisticalTestSigma.cpp.
References vpStatisticalTestAbstract::m_limitUp, m_signal, vpStatisticalTestAbstract::MEAN_DRIFT_NONE, and vpStatisticalTestAbstract::MEAN_DRIFT_UPWARD.
|
staticinherited |
Get the list of available vpMeanDriftType objects that are handled.
| [in] | prefix | The prefix that should be placed before the list. |
| [in] | sep | The separator between each element of the list. |
| [in] | suffix | The suffix that should terminate the list. |
Definition at line 85 of file vpStatisticalTestAbstract.cpp.
References MEAN_DRIFT_COUNT, and vpMeanDriftTypeToString().
|
inlineinherited |
Get the upper and lower limits of the test signal.
| [out] | limitDown | The lower limit. |
| [out] | limitUp | The upper limit. |
Definition at line 181 of file vpStatisticalTestAbstract.h.
References m_limitDown, and m_limitUp.
|
inlineinherited |
Get the mean used as reference.
Definition at line 192 of file vpStatisticalTestAbstract.h.
References m_mean.
|
inlinevirtual |
Get the last value of the signal.
Reimplemented in vpStatisticalTestShewhart.
Definition at line 142 of file vpStatisticalTestSigma.h.
References getSignal(), and m_signal.
Referenced by getSignal().
|
inlineinherited |
Get the standard deviation used as reference.
Definition at line 202 of file vpStatisticalTestAbstract.h.
References m_stdev.
|
inherited |
(Re)Initialize the algorithm.
Definition at line 157 of file vpStatisticalTestAbstract.cpp.
References m_areStatisticsComputed, m_count, m_limitDown, m_limitUp, m_mean, m_nbSamplesForStatistics, m_s, m_stdev, and m_sumForMean.
Referenced by vpStatisticalTestEWMA::init(), vpStatisticalTestEWMA::init(), vpStatisticalTestHinkley::init(), vpStatisticalTestMeanAdjustedCUSUM::init(), vpStatisticalTestMeanAdjustedCUSUM::init(), vpStatisticalTestMeanAdjustedCUSUM::init(), vpStatisticalTestMeanAdjustedCUSUM::init(), vpStatisticalTestShewhart::init(), vpStatisticalTestShewhart::init(), vpStatisticalTestSigma::init(), vpStatisticalTestSigma::init(), vpStatisticalTestEWMA::setAlpha(), vpStatisticalTestEWMA::vpStatisticalTestEWMA(), vpStatisticalTestMeanAdjustedCUSUM::vpStatisticalTestMeanAdjustedCUSUM(), vpStatisticalTestShewhart::vpStatisticalTestShewhart(), vpStatisticalTestShewhart::vpStatisticalTestShewhart(), vpStatisticalTestSigma::vpStatisticalTestSigma(), and vpStatisticalTestSigma::vpStatisticalTestSigma().
| void vpStatisticalTestSigma::init | ( | const float & | h, |
| const float & | mean, | ||
| const float & | stdev ) |
(Re)Initialize the test.
| [in] | h | The alarm factor applied to the standard deviation to compute the limits. |
| [in] | mean | The expected mean of the signal. |
| [in] | stdev | The expected standard deviation of the signal. |
Definition at line 105 of file vpStatisticalTestSigma.cpp.
References computeLimits(), vpStatisticalTestAbstract::init(), vpStatisticalTestAbstract::m_areStatisticsComputed, m_h, vpStatisticalTestAbstract::m_mean, m_signal, and vpStatisticalTestAbstract::m_stdev.
| void vpStatisticalTestSigma::init | ( | const float & | h = 3.f, |
| const unsigned int & | nbSamplesForStats = 30 ) |
(Re)Initialize the test.
| [in] | h | The alarm factor applied to the standard deviation to compute the limits. |
| [in] | nbSamplesForStats | The number of samples to compute the statistics of the signal. |
Definition at line 97 of file vpStatisticalTestSigma.cpp.
References vpStatisticalTestAbstract::init(), m_h, m_signal, and vpStatisticalTestAbstract::setNbSamplesForStat().
|
staticinherited |
Print the message corresponding to the type of mean drift.
| [in] | type | The type of mean drift. |
Definition at line 98 of file vpStatisticalTestAbstract.cpp.
References vpMeanDriftTypeToString().
|
inlineinherited |
Set the minimum value of the standard deviation that is expected. The computed standard deviation cannot be lower this value if set.
| [in] | stdevmin | The minimum value of the standard deviation that is expected. |
Definition at line 226 of file vpStatisticalTestAbstract.h.
References m_stdevmin.
|
inherited |
Set the number of samples required to compute the mean and standard deviation of the signal and allocate the memory accordingly.
| [in] | nbSamples | The number of samples we want to use. |
Definition at line 193 of file vpStatisticalTestAbstract.cpp.
References m_nbSamplesForStatistics, and m_s.
Referenced by vpStatisticalTestEWMA::init(), vpStatisticalTestEWMA::init(), vpStatisticalTestHinkley::init(), vpStatisticalTestHinkley::init(), vpStatisticalTestHinkley::init(), vpStatisticalTestMeanAdjustedCUSUM::init(), vpStatisticalTestMeanAdjustedCUSUM::init(), vpStatisticalTestSigma::init(), and operator=().
|
inherited |
Test if a downward or an upward mean drift occurred according to the new value of the signal.
| [in] | signal | The new value of the signal. |
Definition at line 202 of file vpStatisticalTestAbstract.cpp.
References detectDownwardMeanDrift(), detectUpwardMeanDrift(), m_areStatisticsComputed, MEAN_DRIFT_BOTH, MEAN_DRIFT_NONE, updateStatistics(), and updateTestSignals().
|
inherited |
Test if a downward mean drift occurred according to the new value of the signal.
| [in] | signal | The new value of the signal. |
Definition at line 227 of file vpStatisticalTestAbstract.cpp.
References detectDownwardMeanDrift(), m_areStatisticsComputed, MEAN_DRIFT_NONE, updateStatistics(), and updateTestSignals().
|
inherited |
Test if an upward mean drift occurred according to the new value of the signal.
| [in] | signal | The new value of the signal. |
Definition at line 239 of file vpStatisticalTestAbstract.cpp.
References detectUpwardMeanDrift(), m_areStatisticsComputed, MEAN_DRIFT_NONE, updateStatistics(), and updateTestSignals().
|
protectedvirtual |
Update m_s and if enough values are available, compute the mean, the standard deviation and the limits.
| [in] | signal | The new value of the signal to monitor. |
Reimplemented from vpStatisticalTestAbstract.
Reimplemented in vpStatisticalTestShewhart.
Definition at line 69 of file vpStatisticalTestSigma.cpp.
References computeLimits(), and vpStatisticalTestAbstract::updateStatistics().
|
protectedvirtual |
Update the test signals.
| [in] | signal | The new value of the signal to monitor. |
Implements vpStatisticalTestAbstract.
Reimplemented in vpStatisticalTestShewhart.
Definition at line 78 of file vpStatisticalTestSigma.cpp.
References m_signal.
|
staticinherited |
Cast a string into a vpMeanDriftType.
| [in] | name | The name of the mean drift. |
Definition at line 68 of file vpStatisticalTestAbstract.cpp.
References MEAN_DRIFT_COUNT, MEAN_DRIFT_UNKNOWN, and vpMeanDriftTypeToString().
|
staticinherited |
Cast a vpMeanDriftType into a string.
| [in] | type | The type of mean drift. |
Definition at line 42 of file vpStatisticalTestAbstract.cpp.
References vpException::fatalError, MEAN_DRIFT_BOTH, MEAN_DRIFT_DOWNWARD, MEAN_DRIFT_NONE, MEAN_DRIFT_UNKNOWN, and MEAN_DRIFT_UPWARD.
Referenced by getAvailableMeanDriftType(), print(), and vpMeanDriftTypeFromString().
|
protectedinherited |
Set to true once the mean and the standard deviation are available.
Definition at line 114 of file vpStatisticalTestAbstract.h.
Referenced by init(), vpStatisticalTestEWMA::init(), vpStatisticalTestHinkley::init(), vpStatisticalTestHinkley::init(), vpStatisticalTestMeanAdjustedCUSUM::init(), vpStatisticalTestMeanAdjustedCUSUM::init(), vpStatisticalTestShewhart::init(), vpStatisticalTestSigma::init(), operator=(), testDownUpwardMeanDrift(), testDownwardMeanDrift(), testUpwardMeanDrift(), updateStatistics(), vpStatisticalTestHinkley::updateStatistics(), and vpStatisticalTestAbstract().
|
protectedinherited |
Current number of data used to compute the mean and the standard deviation.
Definition at line 115 of file vpStatisticalTestAbstract.h.
Referenced by vpStatisticalTestHinkley::computeMean(), init(), operator=(), updateStatistics(), vpStatisticalTestHinkley::updateTestSignals(), and vpStatisticalTestAbstract().
|
protected |
The alarm factor applied to the standard deviation to compute the limits.
Definition at line 78 of file vpStatisticalTestSigma.h.
Referenced by computeLimits(), init(), init(), vpStatisticalTestSigma(), and vpStatisticalTestSigma().
|
protectedinherited |
Upper limit for the test signal m_wt.
Definition at line 116 of file vpStatisticalTestAbstract.h.
Referenced by vpStatisticalTestEWMA::computeDeltaAndLimits(), vpStatisticalTestShewhart::computeLimits(), vpStatisticalTestSigma::computeLimits(), vpStatisticalTestEWMA::detectDownwardMeanDrift(), vpStatisticalTestMeanAdjustedCUSUM::detectDownwardMeanDrift(), vpStatisticalTestShewhart::detectDownwardMeanDrift(), vpStatisticalTestSigma::detectDownwardMeanDrift(), getLimits(), init(), operator=(), vpStatisticalTestHinkley::setAlpha(), vpStatisticalTestMeanAdjustedCUSUM::setLimits(), vpStatisticalTestMeanAdjustedCUSUM::updateStatistics(), and vpStatisticalTestAbstract().
|
protectedinherited |
Lower limit for the test signal m_wt
Definition at line 117 of file vpStatisticalTestAbstract.h.
Referenced by vpStatisticalTestEWMA::computeDeltaAndLimits(), vpStatisticalTestShewhart::computeLimits(), vpStatisticalTestSigma::computeLimits(), vpStatisticalTestEWMA::detectUpwardMeanDrift(), vpStatisticalTestMeanAdjustedCUSUM::detectUpwardMeanDrift(), vpStatisticalTestShewhart::detectUpwardMeanDrift(), vpStatisticalTestSigma::detectUpwardMeanDrift(), getLimits(), init(), operator=(), vpStatisticalTestHinkley::setAlpha(), vpStatisticalTestMeanAdjustedCUSUM::setLimits(), vpStatisticalTestMeanAdjustedCUSUM::updateStatistics(), and vpStatisticalTestAbstract().
|
protectedinherited |
Mean of the monitored signal.
Definition at line 118 of file vpStatisticalTestAbstract.h.
Referenced by vpStatisticalTestEWMA::computeDeltaAndLimits(), vpStatisticalTestShewhart::computeLimits(), vpStatisticalTestSigma::computeLimits(), vpStatisticalTestHinkley::computeMean(), vpStatisticalTestHinkley::computeSk(), vpStatisticalTestHinkley::computeTk(), vpStatisticalTestShewhart::detectDownwardMeanDrift(), vpStatisticalTestShewhart::detectUpwardMeanDrift(), getMean(), init(), vpStatisticalTestEWMA::init(), vpStatisticalTestHinkley::init(), vpStatisticalTestHinkley::init(), vpStatisticalTestMeanAdjustedCUSUM::init(), vpStatisticalTestMeanAdjustedCUSUM::init(), vpStatisticalTestMeanAdjustedCUSUM::init(), vpStatisticalTestShewhart::init(), vpStatisticalTestSigma::init(), operator=(), updateStatistics(), vpStatisticalTestEWMA::updateStatistics(), vpStatisticalTestMeanAdjustedCUSUM::updateTestSignals(), and vpStatisticalTestAbstract().
|
protectedinherited |
Number of samples to use to compute the mean and the standard deviation.
Definition at line 119 of file vpStatisticalTestAbstract.h.
Referenced by init(), operator=(), setNbSamplesForStat(), updateStatistics(), and vpStatisticalTestAbstract().
|
protectedinherited |
Array that keeps the samples used to compute the mean and standard deviation.
Definition at line 120 of file vpStatisticalTestAbstract.h.
Referenced by init(), operator=(), setNbSamplesForStat(), updateStatistics(), vpStatisticalTestAbstract(), and ~vpStatisticalTestAbstract().
|
protected |
The last value of the signal.
Definition at line 79 of file vpStatisticalTestSigma.h.
Referenced by detectDownwardMeanDrift(), detectUpwardMeanDrift(), getSignal(), init(), init(), and updateTestSignals().
|
protectedinherited |
Standard deviation of the monitored signal.
Definition at line 121 of file vpStatisticalTestAbstract.h.
Referenced by vpStatisticalTestHinkley::computeAlphaDelta(), vpStatisticalTestEWMA::computeDeltaAndLimits(), vpStatisticalTestMeanAdjustedCUSUM::computeDeltaAndLimits(), vpStatisticalTestShewhart::computeLimits(), vpStatisticalTestSigma::computeLimits(), getStdev(), init(), vpStatisticalTestEWMA::init(), vpStatisticalTestHinkley::init(), vpStatisticalTestMeanAdjustedCUSUM::init(), vpStatisticalTestMeanAdjustedCUSUM::init(), vpStatisticalTestMeanAdjustedCUSUM::init(), vpStatisticalTestShewhart::init(), vpStatisticalTestSigma::init(), operator=(), updateStatistics(), and vpStatisticalTestAbstract().
|
protectedinherited |
Minimum allowed standard deviation of the monitored signal.
Definition at line 122 of file vpStatisticalTestAbstract.h.
Referenced by setMinStdev(), updateStatistics(), and vpStatisticalTestAbstract().
|
protectedinherited |
Sum of the samples used to compute the mean and standard deviation.
Definition at line 123 of file vpStatisticalTestAbstract.h.
Referenced by init(), vpStatisticalTestMeanAdjustedCUSUM::init(), operator=(), updateStatistics(), and vpStatisticalTestAbstract().