/usr/include/openturns/DickeyFullerTest.hxx is in libopenturns-dev 1.7-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | // -*- C++ -*-
/**
* @brief StatTest implements statistical tests
*
* Copyright 2005-2015 Airbus-EDF-IMACS-Phimeca
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef OPENTURNS_DICKEYFULLERTEST_HXX
#define OPENTURNS_DICKEYFULLERTEST_HXX
#include "PersistentObject.hxx"
#include "TestResult.hxx"
#include "Indices.hxx"
#include "TimeSeries.hxx"
BEGIN_NAMESPACE_OPENTURNS
/**
* @class DickeyFullerTest
*
*/
class OT_API DickeyFullerTest
: public PersistentObject
{
CLASSNAME;
public:
/** Default constructor */
DickeyFullerTest();
/** Parameters constructor */
explicit DickeyFullerTest(const TimeSeries & series,
const Bool verbose = true);
/** Virtual constructor */
virtual DickeyFullerTest * clone() const;
/** Test H0: there is a unit root in a drift and linear trend model */
TestResult testUnitRootInDriftAndLinearTrendModel(const NumericalScalar level = 0.95);
/** Test H0: there is a unit root in a drift model */
TestResult testUnitRootInDriftModel(const NumericalScalar level = 0.95);
/** Test H0: there is a unit root in an AR1 model */
TestResult testUnitRootInAR1Model(const NumericalScalar level = 0.95);
/** Strategy of tests */
TestResult runStrategy(const NumericalScalar level = 0.95);
/** Test H0: there is no linear trend in a drift and linear trend model knowing that there is a unit root */
TestResult testUnitRootAndNoLinearTrendInDriftAndLinearTrendModel(const NumericalScalar level = 0.95);
/** Test H0: there is no linear trend in a drift and linear trend model knowing that there is no unit root */
TestResult testNoUnitRootAndNoLinearTrendInDriftAndLinearTrendModel(const NumericalScalar level = 0.95);
/** Test H0: there is no drift in a drift model knowing that there is a unit root */
TestResult testUnitRootAndNoDriftInDriftModel(const NumericalScalar level = 0.95);
/** Test the nullity of drift coefficient with assumption that there is no unit root */
TestResult testNoUnitRootAndNoDriftInDriftModel(const NumericalScalar level = 0.95);
/** Verbosity accessor */
void setVerbose(const Bool verbose);
Bool getVerbose() const;
/** Method save() stores the object through the StorageManager */
void save(Advocate & adv) const;
/** Method load() reloads the object from the StorageManager */
void load(Advocate & adv);
protected:
/** Test of general model ==> run a part of strategy */
TestResult runTrendModelTest(const NumericalScalar level = 0.95);
/** Test of drift model ==> run a part of strategy */
TestResult runDriftModelStrategyTest(const NumericalScalar level = 0.95);
/** Test of random walk model ==> run a part of strategy */
TestResult runRandomWalkModelStrategyTest(const NumericalScalar level = 0.95);
/** Estimate the coefficients of a model with drift and linear trend */
void estimateDriftAndLinearTrendModel();
/** Estimate the coefficients of a model with drift */
void estimateDriftModel();
/** Estimate the coefficients of an AR1 model */
void estimateAR1Model();
private:
/** Time series on which computation is done */
TimeSeries timeSeries_;
/** Size of underlying part */
UnsignedInteger T_;
/** Boolean verbose */
Bool verbose_;
/** Last model evaluated. Values are 1 (AR) to 3 (trend model) */
UnsignedInteger lastModel_;
/** rho value and the variance associated to the estimator */
NumericalScalar rho_;
NumericalScalar sigmaRho_;
/** drift value associated to the estimator */
NumericalScalar drift_;
NumericalScalar sigmaDrift_;
/** trend value associated to the estimator */
NumericalScalar trend_;
NumericalScalar sigmaTrend_;
/** Boolean - Are the characteristic for model without drift computed? */
Bool isComputedNoConstantCharacteristics_;
/** Sum of 1/T * y_{t}*y_{t-1}, t=1,,,N */
NumericalScalar sum_yt_yt_minus_one_;
/** Sum of 1/T * y_{t-1}*y_{t-1}, t=1,,,N */
NumericalScalar sum_squared_yt_minus_one_;
/** Perform the computation of the previous quantities */
void computeNoConstantCharacteristics();
/** Boolean - Are the characteristic for model with drift computed? */
Bool isComputedDriftCharacteristics_;
/** Sum of 1/T * y_{t-1}, t=1,,,N */
NumericalScalar sum_yt_minus_one_;
/** Sum of 1/T * y_{t}, t=1,,,N */
NumericalScalar sum_yt_;
/** Perform the computation of the previous quantities */
void computeDriftCharacteristics();
/** Boolean - Are the characteristic for model with trend computed? */
Bool isComputedTrendCharacteristics_;
/** Sum of 1/T * y_{t-1}* t, t=1,,,N */
NumericalScalar sum_t_yt_minus_one_;
/** Sum of 1/T * y_{t-1}* t, t=1,,,N */
NumericalScalar sum_t_yt_;
/** Sum of 1/T * t_i, t=1,,,N */
NumericalScalar sum_ti_;
/** Sum of 1/T * t_i * t_i, t=1,,,N */
NumericalScalar sum_ti_ti_;
/** Perform the computation of the previous quantity */
void computeTrendCharacteristics() ;
}; /* class DickeyFullerTest */
END_NAMESPACE_OPENTURNS
#endif /* OPENTURNS_DICKEYFULLERTEST_HXX */
|