Changeset 285 for bdm/stat

Show
Ignore:
Timestamp:
03/05/09 14:03:33 (15 years ago)
Author:
smidl
Message:

unit-step experiment TR2245p

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • bdm/stat/libEF.h

    r283 r285  
    323323        //! \name Constructors 
    324324        //!@{ 
    325         egamma ( ) :eEF ( ), alpha(), beta() {}; 
     325        egamma ( ) :eEF ( ), alpha(0), beta(0) {}; 
    326326        egamma ( const vec &a, const vec &b ) {set_parameters ( a, b );}; 
    327327        void set_parameters ( const vec &a, const vec &b ) {alpha=a,beta=b;dim = alpha.length();}; 
     
    629629The standard deviation of the walk is then: \f$\mu/\sqrt(k)\f$. 
    630630 */ 
    631 class migamma_fix : public migamma { 
     631class migamma_ref : public migamma { 
    632632protected: 
    633633        //! parameter l 
     
    637637public: 
    638638        //! Constructor 
    639         migamma_fix ( ) : migamma (),refl ( ) {}; 
     639        migamma_ref ( ) : migamma (),refl ( ) {}; 
    640640        //! Set value of \c k 
    641641        void set_parameters ( double k0 , vec ref0, double l0 ) { 
     
    651651        }; 
    652652}; 
     653 
     654/*! Log-Normal probability density 
     655 only allow diagonal covariances! 
     656 
     657Density of the form \f$ \log(x)\sim \mathcal{N}(\mu,\sigma^2), i.e. 
     658\f[ 
     659x \sim \frac{1}{x\sigma\sqrt{2\pi}}\exp{-\frac{1}{2\sigma^2}(\log(x)-\mu)} 
     660\f] 
     661 
     662*/ 
     663class elognorm: public enorm<ldmat>{ 
     664        public: 
     665                vec sample() const {return exp(enorm<ldmat>::sample());}; 
     666                vec mean() const {vec var=enorm<ldmat>::variance();return exp(mu - 0.5*var);}; 
     667                 
     668}; 
     669 
     670/*! 
     671\brief  Log-Normal random walk 
     672 
     673Mean value, \f$\mu\f$, is... 
     674 
     675==== Check == vv = 
     676Standard deviation of the random walk is proportional to one \f$k\f$-th the mean. 
     677This is achieved by setting \f$\alpha=k\f$ and \f$\beta=k/\mu\f$. 
     678 
     679The standard deviation of the walk is then: \f$\mu/\sqrt(k)\f$. 
     680 */ 
     681class mlognorm : public mpdf { 
     682        protected: 
     683                elognorm eno; 
     684        //! parameter 1/2*sigma^2 
     685                double sig2; 
     686                //! access 
     687                vec &mu; 
     688        public: 
     689        //! Constructor 
     690                mlognorm ( ) : eno (), mu(eno._mu()) {ep=&eno;}; 
     691        //! Set value of \c k 
     692                void set_parameters ( int size, double k) { 
     693                        sig2 = 0.5*log(k*k+1); 
     694                        eno.set_parameters(zeros(size),2*sig2*eye(size)); 
     695                         
     696                        dimc = size; 
     697                }; 
     698 
     699                void condition ( const vec &val ) { 
     700                        mu=log(val)-sig2;//elem_mult ( refl,pow ( val,l ) ); 
     701                }; 
     702}; 
     703 
     704/*! inverse Wishart density 
     705 
     706*/ 
     707class iW : public epdf{ 
     708        public: 
     709                vec sample(){} 
     710}; 
     711 
    653712//! Switch between various resampling methods. 
    654713enum RESAMPLING_METHOD { MULTINOMIAL = 0, STRATIFIED = 1, SYSTEMATIC = 3 };