Changeset bc58504 in tol


Ignore:
Timestamp:
Mar 16, 2009, 5:52:40 PM (18 years ago)
Author:
Víctor de Buen <vdebuen@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
af58f78
Parents:
20f5a51
Message:

Checking built-in method ARIMAAlmagroEval

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tol_tests/tol/random_generation/test_0005/test.tol

    r20f5a51 rbc58504  
    11//////////////////////////////////////////////////////////////////////////////
    22// FILE   : test.tol
    3 // PURPOSE: Test for random generation of parameters of an ARIMA regression
     3// PURPOSE: Test for random generation of parameters of a linear regression
     4//          with ARMA noise
    45//////////////////////////////////////////////////////////////////////////////
    56
    … …  
    78  Text link_ = "";
    89  Text summary_ =
    9    "Test for random generation of parameters of an ARIMA regression" ;
     10   "Test for random generation of parameters of a linear regression with "
     11   "ARMA noise" ;
    1012
    1113  Real PutRandomSeed(1032679103);
    … …  
    3335  //Regular Moving Average polynomial
    3436  Polyn ma = RandStationary(q);
     37  //Full ARIMA struct
     38  Set arima = [[ARIMAStruct(1,ar,ma,1)]];
     39
    3540  //Standard deviation
    3641  Real s = Rand(0.5,2);
    … …  
    6469  Matrix logDens = SetMat(For(1,100,Set(Real iter)
    6570  {
     71
    6672    //Simulates n independent normal variables
    6773    VMatrix b01 = Gaussian(n,1,0,1);
    6874    //Applys the regular linear change of variables to draw the paraneters
    69     VMatrix b_ = nu+CholeskiSolve(L_,b01,"LtP");
     75    VMatrix b_ = nu_+CholeskiSolve(L_,b01,"LtP");
    7076   
    7177    //logarithm of density of linear regression parameters is not affected by
    7278    //a regular linear variable change
    73     Real lgDns_b = MatSum(Log(f01(VMat2Mat(b1))));
     79    Real lgDns_b = MatSum(Log(f01(VMat2Mat(b01))));
    7480 
    7581    VMatrix z_ = (Y-X*b_)*(1/s);
     82    //Calculates logarithm of density of ARMA noise by Levinson method
     83    Set ev.levinson =  ARIMALevinsonEval(arima,VMat2Mat(z_));
     84    Real lgDns_z.levinson = ev.levinson::logLH;
     85
    7686    //Calculates logarithm of density of ARMA noise by Almagro method
    77     NameBlock ev.almagro = ARMAProcess::Eval.Almagro(ar, ma, z_, 1);
    78     Real lgDns_z = ev.almagro::_.logLH;
    79     //Calculates logarithm of density of ARMA noise by Levinson method
    80     Set ev.levinson =  ARIMALevinsonEval([[ARIMAStruct(1,ar,ma,1)]],VMat2Mat(z_));
    81     Real lgDns_z.lev = ev.levinson::logLH;
    82 
    83     [[lgDns_b, lgDns_z, lgDns_z.lev]]
     87    Set ev.almagro = ARIMAAlmagroEval(arima, VMat2Mat(z_));
     88    Real lgDns_z.almagro = ev.almagro::logLH;
     89/*
     90    //Alternative expression for Almagro method
     91    NameBlock ev.almagro_ = ARMAProcess::Eval.Almagro(ar, ma, z_, 1);
     92    Real lgDns_z.almagro_ = ev.almagro_::_.logLH;
     93*/
     94    [[lgDns_b, lgDns_z.almagro, lgDns_z.levinson]]
    8495  }));
    8596  //logarithm of density of linear regression parameters
Note: See TracChangeset for help on using the changeset viewer.