예제 #1
0
파일: ArModel.cpp 프로젝트: cran/Boom
 //======================================================================
 ArModel::ArModel(int number_of_lags)
     : ParamPolicy(new GlmCoefs(Vector(number_of_lags, 0.0), true),
                   new UnivParams(1.0)),
       DataPolicy(new ArSuf(number_of_lags)),
       filter_coefficients_current_(false) {
   Phi_prm()->add_observer([this]() { this->observe_phi(); });
 }
예제 #2
0
파일: ArModel.cpp 프로젝트: comenerv/Boom
 //======================================================================
 ArModel::ArModel(int number_of_lags)
     : ParamPolicy(new VectorParams(number_of_lags, 0),
                   new UnivParams(1.0)),
       DataPolicy(new ArSuf(number_of_lags)),
       filter_coefficients_current_(false)
 {
   Phi_prm()->add_observer(boost::bind(&ArModel::observe_phi, this));
 }
예제 #3
0
파일: ArStateModel.cpp 프로젝트: cran/Boom
 //======================================================================
 ArStateModel::ArStateModel(const ArStateModel &rhs)
     : Model(rhs),
       StateModel(rhs),
       ArModel(rhs),
       state_transition_matrix_(new AutoRegressionTransitionMatrix(Phi_prm())),
       state_variance_matrix_(new UpperLeftCornerMatrixParamView(
           Phi_prm()->nvars_possible(), Sigsq_prm())),
       state_error_expander_(
           new FirstElementSingleColumnMatrix(rhs.number_of_lags())),
       state_error_variance_matrix_(
           new SingleSparseDiagonalElementMatrixParamView(1, Sigsq_prm(), 0)),
       observation_matrix_(rhs.observation_matrix_),
       initial_state_mean_(rhs.initial_state_mean_),
       initial_state_variance_(rhs.initial_state_variance_),
       stationary_initial_distribution_(rhs.stationary_initial_distribution_) {
   DataPolicy::only_keep_sufstats();
 }
예제 #4
0
 //======================================================================
 ArStateModel::ArStateModel(const ArStateModel &rhs)
     : Model(rhs),
       StateModel(rhs),
       ArModel(rhs),
       state_transition_matrix_(new AutoRegressionTransitionMatrix(Phi_prm())),
       state_variance_matrix_(new UpperLeftCornerMatrix(
           Phi_prm()->size(), 1.0)),
       state_variance_is_current_(false),
       observation_matrix_(rhs.observation_matrix_),
       initial_state_mean_(rhs.initial_state_mean_),
       initial_state_variance_(rhs.initial_state_variance_),
       stationary_initial_distribution_(rhs.stationary_initial_distribution_)
 {
   DataPolicy::only_keep_sufstats();
   Sigsq_prm()->add_observer(
       boost::bind(&ArStateModel::observe_residual_variance,
                   this));
 }
예제 #5
0
파일: ArModel.cpp 프로젝트: comenerv/Boom
 ArModel::ArModel(Ptr<VectorParams> phi, Ptr<UnivParams> sigsq)
     : ParamPolicy(phi, sigsq),
       DataPolicy(new ArSuf(phi->size())),
       filter_coefficients_current_(false)
 {
   bool ok = check_stationary(phi->value());
   if (!ok) {
     report_error("Attempt to initialize ArModel with an illegal value "
                  "of the autoregression coefficients.");
   }
   Phi_prm()->add_observer(boost::bind(&ArModel::observe_phi, this));
 }
예제 #6
0
파일: ArModel.cpp 프로젝트: cran/Boom
 ArModel::ArModel(const Ptr<GlmCoefs> &autoregression_coefficients,
                  const Ptr<UnivParams> &innovation_variance)
     : ParamPolicy(autoregression_coefficients, innovation_variance),
       DataPolicy(new ArSuf(autoregression_coefficients->size())),
       filter_coefficients_current_(false) {
   bool ok = check_stationary(autoregression_coefficients->value());
   if (!ok) {
     report_error(
         "Attempt to initialize ArModel with an illegal value "
         "of the autoregression coefficients.");
   }
   Phi_prm()->add_observer([this]() { this->observe_phi(); });
 }
예제 #7
0
파일: ArStateModel.cpp 프로젝트: cran/Boom
 ArStateModel::ArStateModel(int number_of_lags)
     : ArModel(number_of_lags),
       state_transition_matrix_(new AutoRegressionTransitionMatrix(Phi_prm())),
       state_variance_matrix_(
           new UpperLeftCornerMatrixParamView(number_of_lags, Sigsq_prm())),
       state_error_expander_(
           new FirstElementSingleColumnMatrix(number_of_lags)),
       state_error_variance_matrix_(
           new SingleSparseDiagonalElementMatrixParamView(1, Sigsq_prm(), 0)),
       observation_matrix_(number_of_lags),
       initial_state_mean_(number_of_lags, 0.0),
       initial_state_variance_(number_of_lags, 1.0),
       stationary_initial_distribution_(false) {
   observation_matrix_[0] = 1.0;
   DataPolicy::only_keep_sufstats();
 }
예제 #8
0
 ArStateModel::ArStateModel(int number_of_lags)
     : ArModel(number_of_lags),
       state_transition_matrix_(
           new AutoRegressionTransitionMatrix(Phi_prm())),
       state_variance_matrix_(
           new UpperLeftCornerMatrix(number_of_lags, 1.0)),
       state_variance_is_current_(false),
       observation_matrix_(number_of_lags),
       initial_state_mean_(number_of_lags, 0.0),
       initial_state_variance_(number_of_lags, 1.0),
       stationary_initial_distribution_(false)
 {
   observation_matrix_[0] = 1.0;
   DataPolicy::only_keep_sufstats();
   Sigsq_prm()->add_observer(
       boost::bind(&ArStateModel::observe_residual_variance,
                   this));
 }
예제 #9
0
파일: ArModel.cpp 프로젝트: comenerv/Boom
 void ArModel::set_phi(const Vec &phi){
   Phi_prm()->set(phi);
 }
예제 #10
0
파일: ArModel.cpp 프로젝트: comenerv/Boom
 const Vec &ArModel::phi()const{
   return Phi_prm()->value();
 }
예제 #11
0
파일: ArModel.hpp 프로젝트: cran/Boom
 const Ptr<GlmCoefs> coef_prm() const override { return Phi_prm(); }
예제 #12
0
파일: ArModel.hpp 프로젝트: cran/Boom
 Ptr<GlmCoefs> coef_prm() override { return Phi_prm(); }
예제 #13
0
파일: ArStateModel.cpp 프로젝트: cran/Boom
 //======================================================================
 uint ArStateModel::state_dimension() const {
   return Phi_prm()->nvars_possible();
 }
예제 #14
0
 //======================================================================
 uint ArStateModel::state_dimension()const{
   return Phi_prm()->size();
 }