Changeset bc58504 in tol
- Timestamp:
- Mar 16, 2009, 5:52:40 PM (18 years ago)
- Branches:
- 1941-docker-image-to-test, devel, master
- Children:
- af58f78
- Parents:
- 20f5a51
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tol_tests/tol/random_generation/test_0005/test.tol
r20f5a51 rbc58504 1 1 ////////////////////////////////////////////////////////////////////////////// 2 2 // 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 4 5 ////////////////////////////////////////////////////////////////////////////// 5 6 … … 7 8 Text link_ = ""; 8 9 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" ; 10 12 11 13 Real PutRandomSeed(1032679103); … … 33 35 //Regular Moving Average polynomial 34 36 Polyn ma = RandStationary(q); 37 //Full ARIMA struct 38 Set arima = [[ARIMAStruct(1,ar,ma,1)]]; 39 35 40 //Standard deviation 36 41 Real s = Rand(0.5,2); … … 64 69 Matrix logDens = SetMat(For(1,100,Set(Real iter) 65 70 { 71 66 72 //Simulates n independent normal variables 67 73 VMatrix b01 = Gaussian(n,1,0,1); 68 74 //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"); 70 76 71 77 //logarithm of density of linear regression parameters is not affected by 72 78 //a regular linear variable change 73 Real lgDns_b = MatSum(Log(f01(VMat2Mat(b 1))));79 Real lgDns_b = MatSum(Log(f01(VMat2Mat(b01)))); 74 80 75 81 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 76 86 //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]] 84 95 })); 85 96 //logarithm of density of linear regression parameters
Note: See TracChangeset
for help on using the changeset viewer.
