Changeset ea1b10f in tol


Ignore:
Timestamp:
Nov 9, 2009, 1:57:04 PM (17 years ago)
Author:
Víctor de Buen <vdebuen@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
e7af41b
Parents:
176aa3e
Message:

Making standard package

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

Location:
tol_pkg/MhCnstrLinRegArima
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • tol_pkg/MhCnstrLinRegArima/_MhCnstrLinRegArima.tol

    r176aa3e rea1b10f  
    11/////////////////////////////////////////////////////////////////////////////
    22// FILE: _mhCnstrLinRegArima.tol
    3 // PURPOSE: Metropolis-Hastings simulation of a linear regression with ARIMA
    4 // noise and linear inequality constraints
    53/////////////////////////////////////////////////////////////////////////////
    64
    75
     6NameBlock MhCnstrLinRegArima = [[
     7Text _.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
     21Text _.autodoc.keywords = "MCMC,Markov,Bayesian,Metropolis,Hastings,"
     22  "linear,regression,ARIMA,inequality,constraints,polytope";
     23
    824//////////////////////////////////////////////////////////////////////////////
    9 Class @MhCnstrLinRegArima
     25Class @Simulator
    1026//////////////////////////////////////////////////////////////////////////////
    1127{
    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 
    2328  ////////////////////////////////////////////////////////////////////////////
    2429  //Definition members
    … …  
    8691
    8792  ////////////////////////////////////////////////////////////////////////////
    88   //Creates an instance of @MhCnstrLinRegArima
    89   Static @MhCnstrLinRegArima New(
     93  //Creates an instance of @Simulator
     94  Static @Simulator New(
    9095    VMatrix Y,      //Output matrix
    9196    VMatrix X,      //Input matrix
    … …  
    99104  ////////////////////////////////////////////////////////////////////////////
    100105  {
    101     @MhCnstrLinRegArima aux =
     106    @Simulator aux =
    102107    [[
    103108      VMatrix _.Y = Y;
    … …  
    121126  ////////////////////////////////////////////////////////////////////////////
    122127  {
    123     Text _MID = "@MhCnstrLinRegArima::initialize ";
     128    Text _MID = "@Simulator::initialize ";
    124129
    125130    Real ok = Case(
    … …  
    220225  ////////////////////////////////////////////////////////////////////////////
    221226  {
    222     Text _MID = "@MhCnstrLinRegArima::new.candidate ";
     227    Text _MID = "@Simulator::new.candidate ";
    223228    If(!_.r,
    224229    {
    … …  
    287292  ////////////////////////////////////////////////////////////////////////////
    288293  {
    289     Text _MID = "@MhCnstrLinRegArima::maxLikelihoodStep ";
     294    Text _MID = "@Simulator::maxLikelihoodStep ";
    290295    Real iter = 1;
    291296    Real advance = False;
    … …  
    315320  ////////////////////////////////////////////////////////////////////////////
    316321  {
    317     Text _MID = "@MhCnstrLinRegArima::try ";
     322    Text _MID = "@Simulator::try ";
    318323    Real _.tryNumber := _.tryNumber + 1;
    319324    VMatrix c = new.candidate(0);
    … …  
    394399  }
    395400 
    396 };
    397 
    398 
     401}
     402
     403/*
    399404//VBR: UNDER CONSTRUCTION
    400405////////////////////////////////////////////////////////////////////////////
    401 Class @MhCnstrLinRegArimaStd : @MhCnstrLinRegArima
     406Class @Simulator.Std : @Simulator
    402407////////////////////////////////////////////////////////////////////////////
    403408{
    … …  
    407412
    408413  //////////////////////////////////////////////////////////////////////////
    409   Static @MhCnstrLinRegArimaStd New(@MhCnstrLinRegArima reg)
     414  Static @Simulator.Std New(@Simulator reg)
    410415  //////////////////////////////////////////////////////////////////////////
    411416  {
    … …  
    432437    VMatrix Dix = Eye(n,n,0,Mat2VMat(dxi));
    433438
    434     @MhCnstrLinRegArimaStd aux =
     439    @Simulator.Std aux =
    435440    [[
    436441      VMatrix _.Y = Y;
    … …  
    467472  }
    468473
    469 };
     474}
     475*/
     476
     477]];
    470478
    471479
    … …  
    476484  ////////////////////////////////////////////////////////////////////////////
    477485  {
    478     Text _MID = "@MhCnstrLinRegArima::try ";
     486    Text _MID = "@Simulator::try ";
    479487    Real _.tryNumber := _.tryNumber + 1;
    480488    Set c = For(1, length, new.candidate);
  • tol_pkg/MhCnstrLinRegArima/test/test_0001/test_01.tol

    r176aa3e rea1b10f  
    11/////////////////////////////////////////////////////////////////////////////
    22// FILE: test_01.tol
    3 // PURPOSE: Checking class @MhCnstrLinRegArima
     3// PURPOSE: Checking class MhCnstrLinRegArima::@Simulator
    44/////////////////////////////////////////////////////////////////////////////
    55
    6 #Embed "_mhCnstrLinRegArima.tol";
    76
    87/////////////////////////////////////////////////////////////////////////////
    … …  
    1413Real rndSeed = GetRandomSeed(0);
    1514WriteLn("Current Random Seed = "<<rndSeed);
     15
     16#Embed "../../_MhCnstrLinRegArima.tol";
    1617
    1718/////////////////////////////////////////////////////////////////////////////
    … …  
    132133
    133134//Simulation handler
    134 @MhCnstrLinRegArima mclra = @MhCnstrLinRegArima::New(
     135MhCnstrLinRegArima::@Simulator mclra =
     136  MhCnstrLinRegArima::@Simulator::New(
    135137    VMatrix Y,      //Output matrix
    136138    VMatrix X,      //Input matrix
  • tol_pkg/MhCnstrLinRegArima/test/test_0001/test_bsr.tol

    r176aa3e rea1b10f  
    11/////////////////////////////////////////////////////////////////////////////
    22// FILE: test_bsr.tol
    3 // PURPOSE: Checking class @MhCnstrLinRegArima
     3// PURPOSE: Checking class MhCnstrLinRegArima::@Simulator
    44/////////////////////////////////////////////////////////////////////////////
    55
Note: See TracChangeset for help on using the changeset viewer.