Changeset ea1b10f in tol
- Timestamp:
- Nov 9, 2009, 1:57:04 PM (17 years ago)
- Branches:
- 1941-docker-image-to-test, devel, master
- Children:
- e7af41b
- Parents:
- 176aa3e
- Location:
- tol_pkg/MhCnstrLinRegArima
- Files:
-
- 3 edited
-
_MhCnstrLinRegArima.tol (modified) (12 diffs)
-
test/test_0001/test_01.tol (modified) (3 diffs)
-
test/test_0001/test_bsr.tol (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
tol_pkg/MhCnstrLinRegArima/_MhCnstrLinRegArima.tol
r176aa3e rea1b10f 1 1 ///////////////////////////////////////////////////////////////////////////// 2 2 // FILE: _mhCnstrLinRegArima.tol 3 // PURPOSE: Metropolis-Hastings simulation of a linear regression with ARIMA4 // noise and linear inequality constraints5 3 ///////////////////////////////////////////////////////////////////////////// 6 4 7 5 6 NameBlock MhCnstrLinRegArima = [[ 7 Text _.autodoc.description = "Metropolis-Hastings " 8 "simulation of a linear regression with ARIMA noise and linear inequality " 9 "constraints:\n" 10 "\n" 11 "\n Y = X*b + z" 12 "\n A*b <= a" 13 "\n Ar(B)*Dif(B):z = Ma(B):e" 14 "\n e ~ N(0, s^2)" 15 "\n\n" 16 "The tarjet of this package is just to serve as example and test for " 17 "some constrained Metropolis-Hastings simulation methods and related " 18 "functions as Gelman diagnosis.\n" 19 "For more details see mhCnstrLinRegArima.pdf (Sorry only spanish doc)."; 20 21 Text _.autodoc.keywords = "MCMC,Markov,Bayesian,Metropolis,Hastings," 22 "linear,regression,ARIMA,inequality,constraints,polytope"; 23 8 24 ////////////////////////////////////////////////////////////////////////////// 9 Class @ MhCnstrLinRegArima25 Class @Simulator 10 26 ////////////////////////////////////////////////////////////////////////////// 11 27 { 12 Static Text _.autodoc.description = "Basic class for Metropolis-Hastings "13 "simulation of a linear regression with ARIMA noise and linear inequality "14 "constraints:\n"15 "\n"16 "\n Y = X*b + z"17 "\n A*b <= a"18 "\n Ar(B)*Dif(B):z = Ma(B):e"19 "\n e ~ N(0, s^2)"20 "\n"21 "\nFor more details see mhCnstrLinRegArima.pdf (Sorry only spanish doc).";22 23 28 //////////////////////////////////////////////////////////////////////////// 24 29 //Definition members … … 86 91 87 92 //////////////////////////////////////////////////////////////////////////// 88 //Creates an instance of @ MhCnstrLinRegArima89 Static @ MhCnstrLinRegArimaNew(93 //Creates an instance of @Simulator 94 Static @Simulator New( 90 95 VMatrix Y, //Output matrix 91 96 VMatrix X, //Input matrix … … 99 104 //////////////////////////////////////////////////////////////////////////// 100 105 { 101 @ MhCnstrLinRegArimaaux =106 @Simulator aux = 102 107 [[ 103 108 VMatrix _.Y = Y; … … 121 126 //////////////////////////////////////////////////////////////////////////// 122 127 { 123 Text _MID = "@ MhCnstrLinRegArima::initialize ";128 Text _MID = "@Simulator::initialize "; 124 129 125 130 Real ok = Case( … … 220 225 //////////////////////////////////////////////////////////////////////////// 221 226 { 222 Text _MID = "@ MhCnstrLinRegArima::new.candidate ";227 Text _MID = "@Simulator::new.candidate "; 223 228 If(!_.r, 224 229 { … … 287 292 //////////////////////////////////////////////////////////////////////////// 288 293 { 289 Text _MID = "@ MhCnstrLinRegArima::maxLikelihoodStep ";294 Text _MID = "@Simulator::maxLikelihoodStep "; 290 295 Real iter = 1; 291 296 Real advance = False; … … 315 320 //////////////////////////////////////////////////////////////////////////// 316 321 { 317 Text _MID = "@ MhCnstrLinRegArima::try ";322 Text _MID = "@Simulator::try "; 318 323 Real _.tryNumber := _.tryNumber + 1; 319 324 VMatrix c = new.candidate(0); … … 394 399 } 395 400 396 } ;397 398 401 } 402 403 /* 399 404 //VBR: UNDER CONSTRUCTION 400 405 //////////////////////////////////////////////////////////////////////////// 401 Class @ MhCnstrLinRegArimaStd : @MhCnstrLinRegArima406 Class @Simulator.Std : @Simulator 402 407 //////////////////////////////////////////////////////////////////////////// 403 408 { … … 407 412 408 413 ////////////////////////////////////////////////////////////////////////// 409 Static @ MhCnstrLinRegArimaStd New(@MhCnstrLinRegArimareg)414 Static @Simulator.Std New(@Simulator reg) 410 415 ////////////////////////////////////////////////////////////////////////// 411 416 { … … 432 437 VMatrix Dix = Eye(n,n,0,Mat2VMat(dxi)); 433 438 434 @ MhCnstrLinRegArimaStd aux =439 @Simulator.Std aux = 435 440 [[ 436 441 VMatrix _.Y = Y; … … 467 472 } 468 473 469 }; 474 } 475 */ 476 477 ]]; 470 478 471 479 … … 476 484 //////////////////////////////////////////////////////////////////////////// 477 485 { 478 Text _MID = "@ MhCnstrLinRegArima::try ";486 Text _MID = "@Simulator::try "; 479 487 Real _.tryNumber := _.tryNumber + 1; 480 488 Set c = For(1, length, new.candidate); -
tol_pkg/MhCnstrLinRegArima/test/test_0001/test_01.tol
r176aa3e rea1b10f 1 1 ///////////////////////////////////////////////////////////////////////////// 2 2 // FILE: test_01.tol 3 // PURPOSE: Checking class @MhCnstrLinRegArima3 // PURPOSE: Checking class MhCnstrLinRegArima::@Simulator 4 4 ///////////////////////////////////////////////////////////////////////////// 5 5 6 #Embed "_mhCnstrLinRegArima.tol";7 6 8 7 ///////////////////////////////////////////////////////////////////////////// … … 14 13 Real rndSeed = GetRandomSeed(0); 15 14 WriteLn("Current Random Seed = "<<rndSeed); 15 16 #Embed "../../_MhCnstrLinRegArima.tol"; 16 17 17 18 ///////////////////////////////////////////////////////////////////////////// … … 132 133 133 134 //Simulation handler 134 @MhCnstrLinRegArima mclra = @MhCnstrLinRegArima::New( 135 MhCnstrLinRegArima::@Simulator mclra = 136 MhCnstrLinRegArima::@Simulator::New( 135 137 VMatrix Y, //Output matrix 136 138 VMatrix X, //Input matrix -
tol_pkg/MhCnstrLinRegArima/test/test_0001/test_bsr.tol
r176aa3e rea1b10f 1 1 ///////////////////////////////////////////////////////////////////////////// 2 2 // FILE: test_bsr.tol 3 // PURPOSE: Checking class @MhCnstrLinRegArima3 // PURPOSE: Checking class MhCnstrLinRegArima::@Simulator 4 4 ///////////////////////////////////////////////////////////////////////////// 5 5
Note: See TracChangeset
for help on using the changeset viewer.
