Changeset 0b95534 in tol


Ignore:
Timestamp:
Oct 3, 2012, 10:59:26 AM (14 years ago)
Author:
Víctor de Buen <vdebuen@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
6ee9a42
Parents:
3f1b1319
Message:

Refs #1136
fixing bugs in ARMAPreliminaryEstimation

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@5206 be4846ae-f051-483a-831f-b64e7d08527f

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tol/btol/bmodel/estim.cpp

    r3f1b1319 r0b95534  
    377377  BList* lst = NIL;
    378378  BList* aux    = NIL;
     379  BGrammar::IncLevel();
    379380  for(i=0; i<n; i++)
    380381  {
    … …  
    430431  LstFastAppend(lst,aux,inf);
    431432  LstFastAppend(lst,aux,covInf);
    432 
    433433  contens_.RobElement(lst);
     434  BGrammar::DecLevel();
    434435}
    435436
    … …  
    515516  BList* lst    = NIL;
    516517  BList* aux    = NIL;
     518  BGrammar::IncLevel();
    517519  for(i=0; i<n; i++)
    518520  {
    … …  
    573575  LstFastAppend(lst,aux,covInf);
    574576  LstFastAppend(lst,aux,BContensPol::New("",pol, "ARI polyn"));
    575 
    576577  contens_.RobElement(lst);
     578  BGrammar::DecLevel();
    577579}
    578580
    … …  
    633635  BList* lst    = NIL;
    634636  BList* aux    = NIL;
     637  BGrammar::IncLevel();
    635638  for(i=0; i<param.Size(); i++)
    636639  {
    … …  
    689692
    690693  contens_.RobElement(lst);
     694  BGrammar::DecLevel();
    691695}
    692696
    … …  
    741745  BList* lst    = NIL;
    742746  BList* aux    = NIL;
     747  BGrammar::IncLevel();
    743748  for(i=0; i<param.Size(); i++)
    744749  {
    … …  
    812817
    813818  result.RobElement(lst);
     819  BGrammar::DecLevel();
    814820}
    815821
    … …  
    852858  BDat              lnLikelyhood;
    853859  BDat              likelyhood;
     860  BGrammar::IncLevel();
    854861
    855862  Logit(y,X,B,e,p,G,H,lnL,lnLikelyhood,likelyhood);
    … …  
    866873  LstFastAppend(lst,aux,BContensDat::New("", likelyhood, "Log of likelihood"));
    867874  contens_.RobElement(lst);
     875  BGrammar::DecLevel();
    868876
    869877}
    … …  
    891899  BDat              lnLikelyhood;
    892900  BDat              likelyhood;
     901  BGrammar::IncLevel();
    893902
    894903  Probit(y,X,B,e,p,G,H,lnL,lnLikelyhood,likelyhood);
    … …  
    905914  LstFastAppend(lst,aux,BContensDat::New("", likelyhood, "Log of likelihood"));
    906915  contens_.RobElement(lst);
     916  BGrammar::DecLevel();
    907917}
    908918
    … …  
    10901100    BoxCoxTrans(exponent,addition,zTable.Data().Data(), period);
    10911101  }
     1102  BGrammar::IncLevel();
    10921103  BUserDat* exp = BContensDat::New("",exponent,I2("Exponent","Exponente"));
    10931104  BUserDat* add = BContensDat::New("",addition,I2("Addition","Adición"  ));
    10941105  BList* lst = Cons(exp,NCons(add));
    10951106  contens_.RobStruct(lst,BoxCoxStruct_,BSet::Structured);
     1107  BGrammar::DecLevel();
    10961108}
    10971109
    … …  
    12131225  BList* result=NIL;
    12141226  BList* aux=NIL;
     1227  BGrammar::IncLevel();
    12151228
    12161229  BUserMat* UX = BContensMat::New("X",X,I2("Parameters of the model","Parámetros del modelo"));
    … …  
    12971310  }
    12981311  contens_.RobElement(result);
     1312  BGrammar::DecLevel();
    12991313}
    13001314
    … …  
    20712085  }
    20722086  var /= double(N);
     2087  BGrammar::IncLevel();
    20732088  BUserMat* Var = BContensMat::New("MaxLHVar",var, I2("Tra(W)*Inv(Cov)*W : Maximum likelihood estimated varianze of the model",
    20742089                                          "Tra(W)*Inv(Cov)*W : Estimación máximo verosímil de la varianza del modelo"));
    … …  
    21812196*/
    21822197  contens_.RobElement(result);
     2198  BGrammar::DecLevel();
    21832199}
    21842200
    … …  
    22262242  BList* result=NIL;
    22272243  BList* aux=NIL;
     2244  BGrammar::IncLevel();
    22282245  LstFastAppend(result, aux,  BContensMat::New("y",     BMat(y.Size(),1,y.Buffer()),       "Solution"));
    22292246  LstFastAppend(result, aux,  BContensMat::New("PCC",   BMat(y.Size(),1,PACF.Buffer()), "Partial Correlation Coefficients"));
    22302247  LstFastAppend(result, aux,  BContensDat::New("LogDet",logDet, "Log(Det(T))"));
    22312248  contens_.RobElement(result);
     2249  BGrammar::DecLevel();
    22322250/* */
    22332251}
    … …  
    22762294  BMatrix<BDat> y_  (y  .Size()-1,1,y  .Buffer()+1);
    22772295  BMatrix<BDat> PCF_(PCF.Size()-1,1,PCF.Buffer()  );
     2296  BGrammar::IncLevel();
    22782297  LstFastAppend(result, aux,  BContensMat::New("x",x_,      "-Inv(T(r))*c"));
    22792298  LstFastAppend(result, aux,  BContensMat::New("y",y_,      "-Inv(T(r))*R"));
    … …  
    22812300  LstFastAppend(result, aux,  BContensDat::New("LogDet",logDet,  "Log(Det(T(r)))"));
    22822301  contens_.RobElement(result);
     2302  BGrammar::DecLevel();
    22832303}
    22842304
    … …  
    23392359  BMatrix<BDat> y_  (y  .Size()-1,1,y  .Buffer()+1);
    23402360  BMatrix<BDat> PCF_(PCF.Size()-1,1,PCF.Buffer()  );
     2361  BGrammar::IncLevel();
    23412362  LstFastAppend(result, aux,  BContensMat::New("x",x_,      "-Inv(T(r))*c"));
    23422363  LstFastAppend(result, aux,  BContensMat::New("y",y_,      "-Inv(T(r))*R"));
    … …  
    23442365  LstFastAppend(result, aux,  BContensDat::New("LogDet",logDet,  "Log(Det(T(r)))"));
    23452366  contens_.RobElement(result);
     2367  BGrammar::DecLevel();
    23462368}
    23472369
    … …  
    24822504  "Estimates a preliminary AR(p)MA(q) non seassonal model \n"
    24832505  "  \n"
    2484   " (1-phi(B)) z[t] = (1-theta(B)) a[t] ; t = 1 ... N \n"
     2506  " phi(B) z[t] = theta(B) a[t] ; t = 1 ... N \n"
    24852507  " \n"
    24862508  "  a ~ Normal(0,variance*I) \n"
    … …  
    24912513  "must be positive.\n"
    24922514  "If success, it returns a Set with positive real variance and "
    2493   "polynomials 1-phi(B) and 1-phi(B). Elsewhere it returns unknown variance."
     2515  "polynomials phi(B) and theta(B). Elsewhere it returns unknown variance."
     2516  "There is no control about stationarity of both polynomials."
    24942517  "The algorithm is given by Box and Jenkins in their book"
    24952518  "\n"
    … …  
    25342557  }
    25352558  BList* result = NULL, *aux = NULL;
    2536   LstFastAppend(result, aux,  BContensDat::New("variance",variance,     ""));
    2537   LstFastAppend(result, aux,  BContensPol::New("phi",phiB, ""));
    2538   LstFastAppend(result, aux,  BContensPol::New("theta",thetaB,  ""));
     2559  BGrammar::IncLevel();
     2560  BContensDat* variance_ = BContensDat::New("",variance,        "");
     2561  BContensPol* phiB_ = BContensPol::New("",phiB, "");
     2562  BContensPol* thetaB_ =  BContensPol::New("",thetaB,  "");
     2563  variance_->PutName("variance");
     2564  phiB_->PutName("phi");
     2565  thetaB_->PutName("theta");
     2566  LstFastAppend(result, aux, variance_);
     2567  LstFastAppend(result, aux, phiB_);
     2568  LstFastAppend(result, aux, thetaB_);
    25392569  contens_.RobElement(result);
     2570  BGrammar::DecLevel();
    25402571}
    25412572
Note: See TracChangeset for help on using the changeset viewer.