Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r55939 - in sandbox/statistics/model: . boost boost/statistics boost/statistics/model boost/statistics/model/algorithm boost/statistics/model/functional boost/statistics/model/wrap boost/statistics/model/wrap/aggregate boost/statistics/model/wrap/unary boost/statistics/model/wrap/unary/detail libs libs/statistics libs/statistics/model libs/statistics/model/doc
From: erwann.rogard_at_[hidden]
Date: 2009-08-31 21:09:44


Author: e_r
Date: 2009-08-31 21:09:41 EDT (Mon, 31 Aug 2009)
New Revision: 55939
URL: http://svn.boost.org/trac/boost/changeset/55939

Log:
re-adding model preceded by dir statistics
Added:
   sandbox/statistics/model/
   sandbox/statistics/model/boost/
   sandbox/statistics/model/boost/statistics/
   sandbox/statistics/model/boost/statistics/model/
   sandbox/statistics/model/boost/statistics/model/algorithm/
   sandbox/statistics/model/boost/statistics/model/algorithm/include.hpp (contents, props changed)
   sandbox/statistics/model/boost/statistics/model/algorithm/log_likelihood.hpp (contents, props changed)
   sandbox/statistics/model/boost/statistics/model/algorithm/log_likelihoods.hpp (contents, props changed)
   sandbox/statistics/model/boost/statistics/model/algorithm/log_posteriors.hpp (contents, props changed)
   sandbox/statistics/model/boost/statistics/model/algorithm/log_posteriors2.hpp (contents, props changed)
   sandbox/statistics/model/boost/statistics/model/functional/
   sandbox/statistics/model/boost/statistics/model/functional/include.hpp (contents, props changed)
   sandbox/statistics/model/boost/statistics/model/functional/log_likelihood_accumulator.hpp (contents, props changed)
   sandbox/statistics/model/boost/statistics/model/functional/log_likelihood_evaluator.hpp (contents, props changed)
   sandbox/statistics/model/boost/statistics/model/functional/log_posterior_evaluator.hpp (contents, props changed)
   sandbox/statistics/model/boost/statistics/model/functional/log_prior_evaluator.hpp (contents, props changed)
   sandbox/statistics/model/boost/statistics/model/include.hpp (contents, props changed)
   sandbox/statistics/model/boost/statistics/model/wrap/
   sandbox/statistics/model/boost/statistics/model/wrap/aggregate/
   sandbox/statistics/model/boost/statistics/model/wrap/aggregate/data.hpp (contents, props changed)
   sandbox/statistics/model/boost/statistics/model/wrap/aggregate/dataset.hpp (contents, props changed)
   sandbox/statistics/model/boost/statistics/model/wrap/aggregate/model_covariate_parameter.hpp (contents, props changed)
   sandbox/statistics/model/boost/statistics/model/wrap/aggregate/model_data.hpp (contents, props changed)
   sandbox/statistics/model/boost/statistics/model/wrap/aggregate/model_dataset.hpp (contents, props changed)
   sandbox/statistics/model/boost/statistics/model/wrap/aggregate/model_parameter.hpp (contents, props changed)
   sandbox/statistics/model/boost/statistics/model/wrap/aggregate/prior_model_dataset.hpp (contents, props changed)
   sandbox/statistics/model/boost/statistics/model/wrap/include.hpp (contents, props changed)
   sandbox/statistics/model/boost/statistics/model/wrap/unary/
   sandbox/statistics/model/boost/statistics/model/wrap/unary/covariate.hpp (contents, props changed)
   sandbox/statistics/model/boost/statistics/model/wrap/unary/covariates.hpp (contents, props changed)
   sandbox/statistics/model/boost/statistics/model/wrap/unary/detail/
   sandbox/statistics/model/boost/statistics/model/wrap/unary/detail/base.hpp (contents, props changed)
   sandbox/statistics/model/boost/statistics/model/wrap/unary/model.hpp (contents, props changed)
   sandbox/statistics/model/boost/statistics/model/wrap/unary/parameter.hpp (contents, props changed)
   sandbox/statistics/model/boost/statistics/model/wrap/unary/prior.hpp (contents, props changed)
   sandbox/statistics/model/boost/statistics/model/wrap/unary/response.hpp (contents, props changed)
   sandbox/statistics/model/boost/statistics/model/wrap/unary/responses.hpp (contents, props changed)
   sandbox/statistics/model/libs/
   sandbox/statistics/model/libs/statistics/
   sandbox/statistics/model/libs/statistics/model/
   sandbox/statistics/model/libs/statistics/model/doc/
   sandbox/statistics/model/libs/statistics/model/doc/readme.txt (contents, props changed)

Added: sandbox/statistics/model/boost/statistics/model/algorithm/include.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/model/boost/statistics/model/algorithm/include.hpp 2009-08-31 21:09:41 EDT (Mon, 31 Aug 2009)
@@ -0,0 +1,16 @@
+///////////////////////////////////////////////////////////////////////////////
+// model::algorithm::include.hpp //
+// //
+// Copyright 2009 Erwann Rogard. Distributed under the Boost //
+// Software License, Version 1.0. (See accompanying file //
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
+///////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_STATISTICS_MODEL_ALGORITHM_INCLUDE_HPP_ER_2009
+#define BOOST_STATISTICS_MODEL_ALGORITHM_INCLUDE_HPP_ER_2009
+
+#include <boost/statistics/model/algorithm/log_likelihood.hpp>
+#include <boost/statistics/model/algorithm/log_likelihoods.hpp>
+#include <boost/statistics/model/algorithm/log_posteriors.hpp>
+#include <boost/statistics/model/algorithm/log_posteriors2.hpp>
+
+#endif
\ No newline at end of file

Added: sandbox/statistics/model/boost/statistics/model/algorithm/log_likelihood.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/model/boost/statistics/model/algorithm/log_likelihood.hpp 2009-08-31 21:09:41 EDT (Mon, 31 Aug 2009)
@@ -0,0 +1,44 @@
+///////////////////////////////////////////////////////////////////////////////
+// model::algorithm::log_likelihood.hpp //
+// //
+// Copyright 2009 Erwann Rogard. Distributed under the Boost //
+// Software License, Version 1.0. (See accompanying file //
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
+///////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_STATISTICS_MODEL_ALGORITHM_LOG_LIKELIHOOD_HPP_ER_2009
+#define BOOST_STATISTICS_MODEL_ALGORITHM_LOG_LIKELIHOOD_HPP_ER_2009
+#include <boost/binary_op/algorithm/for_each.hpp>
+#include <boost/statistics/model/wrap/aggregate/model_parameter.hpp>
+#include <boost/statistics/model/functional/log_likelihood_accumulator.hpp>
+
+namespace boost{
+namespace statistics{
+namespace model{
+
+ // Evaluates the likelihood at mp.parameter(), given model mp.model(),
+ // by summing all contributions from a dataset i.e. a
+ // sequence of covariates, [b_x,e_x), and reponses (starting at b_y)
+ template<typename T,typename M,typename P,typename ItX,typename ItE>
+ T
+ log_likelihood(
+ model_parameter_<M,P> mp,
+ ItX b_x,
+ ItX e_x,
+ ItE b_y
+ ){
+ typedef log_likelihood_accumulator<T,M,P> acc_;
+ acc_ acc(mp);
+ return boost::binary_op::for_each<acc_>(
+ b_x,
+ e_x,
+ b_y,
+ acc
+ ).value();
+ }
+
+
+}// model
+}// statistics
+}// boost
+
+#endif
\ No newline at end of file

Added: sandbox/statistics/model/boost/statistics/model/algorithm/log_likelihoods.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/model/boost/statistics/model/algorithm/log_likelihoods.hpp 2009-08-31 21:09:41 EDT (Mon, 31 Aug 2009)
@@ -0,0 +1,72 @@
+///////////////////////////////////////////////////////////////////////////////
+// model::algorithm::log_likelihoods.hpp //
+// //
+// Copyright 2009 Erwann Rogard. Distributed under the Boost //
+// Software License, Version 1.0. (See accompanying file //
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
+///////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_STATISTICS_MODEL_ALGORITHM_LOG_LIKELIHOODS_HPP_ER_2009
+#define BOOST_STATISTICS_MODEL_ALGORITHM_LOG_LIKELIHOODS_HPP_ER_2009
+#include <algorithm>
+#include <boost/lambda/bind.hpp>
+#include <boost/lambda/lambda.hpp>
+#include <boost/statistics/model/wrap/aggregate/model_dataset.hpp>
+#include <boost/statistics/model/functional/log_likelihood_evaluator.hpp>
+
+namespace boost{
+namespace statistics{
+namespace model{
+
+// Evaluates the log-likelihood for each parameter in [b_p,e_p), given
+// model and data md
+template<typename T,
+ typename M,typename Rx,typename Ry,typename ItP,typename ItLw>
+ItLw log_likelihoods(
+ model_dataset_<M,Rx,Ry> md,
+ ItP b_p,
+ ItP e_p,
+ ItLw o_lw
+){
+ typedef log_likelihood_evaluator<T,M,Rx,Ry> eval_;
+ return std::transform(
+ b_p,
+ e_p,
+ o_lw,
+ eval_(md)
+ );
+}
+
+// Maps the input log-pdf to the ratio-log-pdf
+template<
+ typename T,
+ typename M,
+ typename Rx,
+ typename Ry,
+ typename ItP,
+ typename ItLw
+>
+ItLw
+log_likelihoods(
+ model_dataset_<M,Rx,Ry> md,
+ ItP b_p,
+ ItP e_p,
+ ItLw b_lw,
+ ItLw o_lw // lw <- (log_likelihod - lw)
+){
+ typedef log_likelihood_evaluator<T,M,Rx,Ry> eval_;
+ eval_ e(md);
+ return std::transform(
+ b_p,
+ e_p,
+ b_lw,
+ o_lw,
+ boost::lambda::bind(e,boost::lambda::_2) - boost::lambda::_1
+ );
+}
+
+
+}// model
+}// statistics
+}// boost
+
+#endif
\ No newline at end of file

Added: sandbox/statistics/model/boost/statistics/model/algorithm/log_posteriors.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/model/boost/statistics/model/algorithm/log_posteriors.hpp 2009-08-31 21:09:41 EDT (Mon, 31 Aug 2009)
@@ -0,0 +1,80 @@
+///////////////////////////////////////////////////////////////////////////////
+// model::algorithm::log_posteriors.hpp //
+// //
+// Copyright 2009 Erwann Rogard. Distributed under the Boost //
+// Software License, Version 1.0. (See accompanying file //
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
+///////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_STATISTICS_MODEL_ALGORITHM_LOG_POSTERIORS_HPP_ER_2009
+#define BOOST_STATISTICS_MODEL_ALGORITHM_LOG_POSTERIORS_HPP_ER_2009
+#include <algorithm>
+#include <boost/lambda/lambda.hpp>
+#include <boost/statistics/model/wrap/aggregate/prior_model_dataset.hpp>
+#include <boost/statistics/model/functional/log_posterior_evaluator.hpp>
+
+namespace boost{
+namespace statistics{
+namespace model{
+
+// Evaluates the log-postetior for each parameter in [b_p,e_p)
+//
+// Warning : log_posteriors seems very suceptible to precision error.
+// log_posteriors2 appears to correct this problem.
+template<
+ typename T,typename D,typename M,typename Rx,typename Ry,typename ItP,
+ typename ItLw
+>
+ItLw
+log_posteriors(
+ boost::statistics::model::prior_model_dataset_<D,M,Rx,Ry> pmd,
+ ItP b_p,
+ ItP e_p,
+ ItLw o_lw
+){
+ typedef log_posterior_evaluator<T,D,M,Rx,Ry> eval_;
+ return std::transform(
+ b_p,
+ e_p,
+ o_lw,
+ eval_(pmd)
+ );
+}
+
+// log-pdf_Q --> log_pdf P + log_pdf L - log_pdf_Q
+template<
+ typename T,
+ typename D,
+ typename M,
+ typename Rx,
+ typename Ry,
+ typename ItP,
+ typename ItLw,
+ typename ItLw2
+>
+ItLw
+log_posteriors(
+ prior_model_dataset_<D,M,Rx,Ry> pmd,
+ ItP b_p,
+ ItP e_p,
+ ItLw b_lw,
+ ItLw2 o_lw // lw <- (log_posterior - lw)
+){
+ typedef log_posterior_evaluator<T,D,M,Rx,Ry> eval_;
+ eval_ e(pmd);
+ return std::transform(
+ b_p, //1
+ e_p,
+ b_lw, //2
+ o_lw,
+ boost::lambda::bind(
+ e,
+ boost::lambda::_1
+ ) - boost::lambda::_2
+ );
+}
+
+}// model
+}// statistics
+}// boost
+
+#endif
\ No newline at end of file

Added: sandbox/statistics/model/boost/statistics/model/algorithm/log_posteriors2.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/model/boost/statistics/model/algorithm/log_posteriors2.hpp 2009-08-31 21:09:41 EDT (Mon, 31 Aug 2009)
@@ -0,0 +1,94 @@
+///////////////////////////////////////////////////////////////////////////////
+// model::algorithm::log_posteriors2.hpp //
+// //
+// Copyright 2009 Erwann Rogard. Distributed under the Boost //
+// Software License, Version 1.0. (See accompanying file //
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
+///////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_MODEL_ALGORITHM_LOG_POSTERIORS2_HPP_ER_2009
+#define BOOST_MODEL_ALGORITHM_LOG_POSTERIORS2_HPP_ER_2009
+#include <algorithm>
+#include <boost/lambda/lambda.hpp>
+#include <boost/statistics/model/wrap/aggregate/prior_model_dataset.hpp>
+#include <boost/statistics/model/functional/log_prior_evaluator.hpp>
+#include <boost/statistics/model/functional/log_likelihood_evaluator.hpp>
+
+namespace boost{
+namespace statistics{
+namespace model{
+
+// Evaluates the log-postetior for each parameter in [b_p,e_p)
+template<
+ typename T,typename D,typename M,typename Rx,typename Ry,typename ItP,
+ typename ItLw
+>
+ItLw
+log_posteriors2(
+ boost::statistics::model::prior_model_dataset_<D,M,Rx,Ry> pmd,
+ ItP b_p,
+ ItP e_p,
+ ItLw o_lw
+){
+ typedef log_prior_evaluator<T,D> eval0_;
+ typedef log_likelihood_evaluator<T,M,Rx,Ry> eval_;
+ return std::transform(
+ b_p,
+ e_p,
+ o_lw,
+ boost::lambda::bind(
+ eval0_(pmd),
+ boost::lambda::_1
+ ) + boost::lambda::bind(
+ eval_(pmd),
+ boost::lambda::_1
+ )
+ );
+}
+
+// log-pdf_Q --> log_pdf P + log_pdf L - log_pdf_Q
+template<
+ typename T,
+ typename D,
+ typename M,
+ typename Rx,
+ typename Ry,
+ typename ItP,
+ typename ItLw,
+ typename ItLw2
+>
+ItLw
+log_posteriors2(
+ prior_model_dataset_<D,M,Rx,Ry> pmd,
+ ItP b_p,
+ ItP e_p,
+ ItLw b_lw,
+ ItLw2 o_lw // lw <- (log_posterior - lw)
+){
+ typedef log_prior_evaluator<T,D> eval0_;
+ typedef log_likelihood_evaluator<T,M,Rx,Ry> eval_;
+ eval0_ e0(pmd);
+ eval_ e(pmd);
+ return std::transform(
+ b_p, //1
+ e_p,
+ b_lw, //2
+ o_lw,
+ boost::lambda::bind(
+ e,
+ boost::lambda::_1
+ ) +
+ (
+ boost::lambda::bind(
+ e0,
+ boost::lambda::_1
+ )
+ - boost::lambda::_2
+ )
+ );
+}
+
+}// model
+}// statistics
+}// boost
+
+#endif
\ No newline at end of file

Added: sandbox/statistics/model/boost/statistics/model/functional/include.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/model/boost/statistics/model/functional/include.hpp 2009-08-31 21:09:41 EDT (Mon, 31 Aug 2009)
@@ -0,0 +1,16 @@
+///////////////////////////////////////////////////////////////////////////////
+// model::functional::include.hpp //
+// //
+// Copyright 2009 Erwann Rogard. Distributed under the Boost //
+// Software License, Version 1.0. (See accompanying file //
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
+///////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_STATISTICS_MODEL_FUNCTIONAL_INCLUDE_HPP_ER_2009
+#define BOOST_STATISTICS_MODEL_FUNCTIONAL_INCLUDE_HPP_ER_2009
+
+#include <boost/statistics/model/functional/log_likelihood_accumulator.hpp>
+#include <boost/statistics/model/functional/log_likelihood_evaluator.hpp>
+#include <boost/statistics/model/functional/log_posterior_evaluator.hpp>
+#include <boost/statistics/model/functional/log_prior_evaluator.hpp>
+
+#endif
\ No newline at end of file

Added: sandbox/statistics/model/boost/statistics/model/functional/log_likelihood_accumulator.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/model/boost/statistics/model/functional/log_likelihood_accumulator.hpp 2009-08-31 21:09:41 EDT (Mon, 31 Aug 2009)
@@ -0,0 +1,147 @@
+///////////////////////////////////////////////////////////////////////////////
+// model::functional::log_likelihood_accumulator.hpp //
+// //
+// Copyright 2009 Erwann Rogard. Distributed under the Boost //
+// Software License, Version 1.0. (See accompanying file //
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
+///////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_STATISTICS_MODEL_FUNCTIONAL_LOG_LIKELIHOOD_ACCUMULATOR_HPP_ER_2009
+#define BOOST_STATISTICS_MODEL_FUNCTIONAL_LOG_LIKELIHOOD_ACCUMULATOR_HPP_ER_2009
+#include <boost/type_traits.hpp>
+#include <boost/call_traits.hpp>
+#include <boost/operators.hpp>
+#include <boost/statistics/model/wrap/aggregate/model_parameter.hpp>
+#include <boost/statistics/model/wrap/aggregate/model_data.hpp>
+#include <boost/joint_dist/unscope/log_unnormalized_pdf.hpp>
+#include <boost/scalar_dist/unscope/log_unnormalized_pdf.hpp>
+
+namespace boost{
+
+ // fwd declare
+ template<typename T,typename M,typename X,typename Y,typename P>
+ T log_likelihood(
+ statistics::model::model_data_<M,X,Y>,
+ const P&
+ );
+
+namespace statistics{
+namespace model{
+
+// Functor that accumulates the data contribution to the likelihood of a model
+// and its parameter.
+//
+// Used by algorithm::log_likelihood
+template<
+ typename T, // result_type
+ typename M, // Model
+ typename P // parameter
+>
+class log_likelihood_accumulator : boost::addable<
+ log_likelihood_accumulator<T,M,P>
+>{
+public:
+ typedef T result_type;
+ typedef model_parameter_<M,P> model_parameter_type;
+
+
+ // Construction
+ log_likelihood_accumulator();
+ log_likelihood_accumulator(model_parameter_type);
+ log_likelihood_accumulator(const log_likelihood_accumulator& );
+ log_likelihood_accumulator& operator=(const log_likelihood_accumulator& );
+
+ // Operator
+ log_likelihood_accumulator& operator+=(
+ const log_likelihood_accumulator& that
+ );
+
+ // Update
+ template<typename X,typename Y>
+ result_type operator()(const X&,const Y& y);
+
+ // Access
+ const model_parameter_type& model_parameter()const;
+ result_type value()const;
+
+private:
+ model_parameter_type mp_;
+ result_type cum_sum_;
+ static result_type zero_;
+};
+
+ // Implementation //
+
+template<typename T,typename M,typename P>
+typename log_likelihood_accumulator<T,M,P>::result_type
+log_likelihood_accumulator<T,M,P>::zero_ = static_cast<result_type>(0);
+
+// Construction
+template<typename T,typename M,typename P>
+log_likelihood_accumulator<T,M,P>::log_likelihood_accumulator()
+:mp_(),cum_sum_(zero_){}
+
+template<typename T,typename M,typename P>
+log_likelihood_accumulator<T,M,P>::log_likelihood_accumulator(
+ model_parameter_type mp
+):mp_(mp),cum_sum_(zero_){}
+
+template<typename T,typename M,typename P>
+log_likelihood_accumulator<T,M,P>::log_likelihood_accumulator(
+ const log_likelihood_accumulator& that
+):mp_(that.mp_),cum_sum_(that.cum_sum_){}
+
+template<typename T,typename M,typename P>
+log_likelihood_accumulator<T,M,P>&
+log_likelihood_accumulator<T,M,P>::operator=(
+ const log_likelihood_accumulator& that
+){
+ if(&that!=this){
+ mp_ = that.mp_;
+ cum_sum_ = that.cum_sum_;
+ }
+ return (*this);
+}
+
+// Operator
+
+template<typename T,typename M,typename P>
+log_likelihood_accumulator<T,M,P>&
+log_likelihood_accumulator<T,M,P>::operator+=(
+ const log_likelihood_accumulator& that
+){
+ (this->cum_sum_)+= that.value();
+}
+
+// Update
+template<typename T,typename M,typename P>
+template<typename X,typename Y>
+typename log_likelihood_accumulator<T,M,P>::result_type
+log_likelihood_accumulator<T,M,P>::operator()(const X& x,const Y& y){
+
+ result_type l = log_likelihood<T>(
+ make_model_data(
+ model_parameter().model(),
+ x,
+ y
+ ),
+ model_parameter().parameter()
+ );
+ cum_sum_ += l;
+ return cum_sum_;
+}
+
+// Access
+
+template<typename T,typename M,typename P>
+const typename log_likelihood_accumulator<T,M,P>::model_parameter_type&
+log_likelihood_accumulator<T,M,P>::model_parameter()const{ return mp_; }
+
+template<typename T,typename M,typename P>
+typename log_likelihood_accumulator<T,M,P>::result_type
+log_likelihood_accumulator<T,M,P>::value()const{ return cum_sum_; }
+
+}// model
+}// statistics
+}// boost
+
+#endif
\ No newline at end of file

Added: sandbox/statistics/model/boost/statistics/model/functional/log_likelihood_evaluator.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/model/boost/statistics/model/functional/log_likelihood_evaluator.hpp 2009-08-31 21:09:41 EDT (Mon, 31 Aug 2009)
@@ -0,0 +1,99 @@
+///////////////////////////////////////////////////////////////////////////////
+// model::functional::log_likelihood_evaluator.hpp //
+// //
+// Copyright 2009 Erwann Rogard. Distributed under the Boost //
+// Software License, Version 1.0. (See accompanying file //
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
+///////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_STATISTICS_MODEL_FUNCTIONAL_LOG_LIKELIHOOD_EVALUATOR_HPP_ER_2009
+#define BOOST_STATISTICS_MODEL_FUNCTIONAL_LOG_LIKELIHOOD_EVALUATOR_HPP_ER_2009
+#include <boost/range.hpp>
+#include <boost/statistics/model/wrap/aggregate/model_parameter.hpp>
+#include <boost/statistics/model/wrap/aggregate/model_dataset.hpp>
+#include <boost/statistics/model/algorithm/log_likelihood.hpp>
+
+namespace boost{
+namespace statistics{
+namespace model{
+
+ // Evaluates the log-likelihood at a parameter values given a model and
+ // a dataset.
+ //
+ // T is the result_type
+ template<typename T,typename M,typename Rx,typename Ry>
+ class log_likelihood_evaluator{
+ public:
+ typedef T result_type;
+ typedef model_dataset_<M,Rx,Ry> model_dataset_type;
+
+ // Constructor
+ log_likelihood_evaluator();
+ log_likelihood_evaluator(const model_dataset_type&);
+ log_likelihood_evaluator(const log_likelihood_evaluator&);
+ log_likelihood_evaluator& operator=(const log_likelihood_evaluator&);
+
+ // Evaluate
+ template<typename P> result_type operator()(const P& p)const;
+
+ // Access
+ const model_dataset_type& model_dataset()const;
+
+ private:
+ model_dataset_type md_;
+ };
+
+ // Implementation //
+
+ // Construction
+ template<typename T,typename M,typename Rx,typename Ry>
+ log_likelihood_evaluator<T,M,Rx,Ry>::log_likelihood_evaluator(){}
+
+ template<typename T,typename M,typename Rx,typename Ry>
+ log_likelihood_evaluator<T,M,Rx,Ry>::log_likelihood_evaluator(
+ const model_dataset_type& md
+ ):md_(md){}
+
+ template<typename T,typename M,typename Rx,typename Ry>
+ log_likelihood_evaluator<T,M,Rx,Ry>::log_likelihood_evaluator(
+ const log_likelihood_evaluator& that
+ ):md_(that.md_){}
+
+ template<typename T,typename M,typename Rx,typename Ry>
+ log_likelihood_evaluator<T,M,Rx,Ry>&
+ log_likelihood_evaluator<T,M,Rx,Ry>::operator=(
+ const log_likelihood_evaluator& that
+ ){
+ if(&that!=this){
+ md_ = (that.md_);
+ }
+ return (*this);
+ }
+
+ // Evaluate
+ template<typename T,typename M,typename Rx,typename Ry>
+ template<typename P>
+ typename log_likelihood_evaluator<T,M,Rx,Ry>::result_type
+ log_likelihood_evaluator<T,M,Rx,Ry>::operator()(const P& p)const{
+ return log_likelihood<T>(
+ make_model_parameter(
+ model_dataset().model(),
+ p
+ ),
+ boost::begin( model_dataset().covariates() ),
+ boost::end( model_dataset().covariates() ),
+ boost::begin( model_dataset().responses() )
+ );
+ }
+
+ // Access
+ template<typename T,typename M,typename Rx,typename Ry>
+ const typename log_likelihood_evaluator<T,M,Rx,Ry>::model_dataset_type&
+ log_likelihood_evaluator<T,M,Rx,Ry>::model_dataset()const{
+ return (this->md_);
+ }
+
+}// model
+}// statistics
+}// boost
+
+#endif
\ No newline at end of file

Added: sandbox/statistics/model/boost/statistics/model/functional/log_posterior_evaluator.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/model/boost/statistics/model/functional/log_posterior_evaluator.hpp 2009-08-31 21:09:41 EDT (Mon, 31 Aug 2009)
@@ -0,0 +1,109 @@
+///////////////////////////////////////////////////////////////////////////////
+// model::functional::log_posterior_evaluator.hpp //
+// //
+// Copyright 2009 Erwann Rogard. Distributed under the Boost //
+// Software License, Version 1.0. (See accompanying file //
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
+///////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_STATISTICS_MODEL_FUNCTIONAL_LOG_POSTERIOR_EVALUATOR_HPP_ER_2009
+#define BOOST_STATISTICS_MODEL_FUNCTIONAL_LOG_POSTERIOR_EVALUATOR_HPP_ER_2009
+#include <boost/type_traits.hpp>
+#include <boost/call_traits.hpp>
+#include <boost/operators.hpp>
+#include <boost/binary_op/algorithm/for_each.hpp>
+#include <boost/joint_dist/unscope/log_unnormalized_pdf.hpp>
+#include <boost/scalar_dist/unscope/log_unnormalized_pdf.hpp>
+#include <boost/statistics/model/wrap/aggregate/prior_model_dataset.hpp>
+#include <boost/statistics/model/functional/log_likelihood_evaluator.hpp>
+
+namespace boost{
+namespace statistics{
+namespace model{
+
+ // Augments algorithm::log_likehood with a prior of type D
+ //
+ // Requirements:
+ // Let d denote an instance of D and p a parameter, then
+ // log_unnormalized_pdf(p_dist,p) must return an object of type T
+ template<typename T,typename D,typename M,typename Rx,typename Ry>
+ class log_posterior_evaluator : log_likelihood_evaluator<T,M,Rx,Ry>{
+ typedef log_likelihood_evaluator<T,M,Rx,Ry> super_;
+ public:
+ typedef prior_model_dataset_<D,M,Rx,Ry> prior_model_dataset_type;
+ typedef typename prior_model_dataset_type::prior_type prior_type;
+ typedef typename super_::result_type result_type;
+
+ // Constructor
+ log_posterior_evaluator();
+ log_posterior_evaluator(const prior_model_dataset_type&);
+ log_posterior_evaluator(const log_posterior_evaluator&);
+ log_posterior_evaluator& operator=(const log_posterior_evaluator&);
+
+ // Evaluate
+ template<typename P>
+ result_type operator()(const P& p)const;
+
+ // Access
+ const prior_model_dataset_type& prior_model_dataset()const;
+
+ private:
+ prior_model_dataset_type pmd_;
+ };
+
+ // Implementation //
+
+ // Construction
+ template<typename T,typename D,typename M,typename Rx,typename Ry>
+ log_posterior_evaluator<T,D,M,Rx,Ry>::log_posterior_evaluator():
+ super_(){}
+
+ template<typename T,typename D,typename M,typename Rx,typename Ry>
+ log_posterior_evaluator<T,D,M,Rx,Ry>::log_posterior_evaluator(
+ const prior_model_dataset_type& pmd
+ ):super_(pmd),pmd_(pmd){}
+
+ template<typename T,typename D,typename M,typename Rx,typename Ry>
+ log_posterior_evaluator<T,D,M,Rx,Ry>::log_posterior_evaluator(
+ const log_posterior_evaluator& that
+ ):super_(that),pmd_(that.pmd_){}
+
+ template<typename T,typename D,typename M,typename Rx,typename Ry>
+ log_posterior_evaluator<T,D,M,Rx,Ry>&
+ log_posterior_evaluator<T,D,M,Rx,Ry>::operator=(
+ const log_posterior_evaluator& that
+ ){
+ if(&that!=this){
+ super_::operator=(that);
+ pmd_ = (that.pmd_);
+ }
+ return (*this);
+ }
+
+ // Evaluate
+ template<typename T,typename D,typename M,typename Rx,typename Ry>
+ template<typename P>
+ typename log_posterior_evaluator<T,D,M,Rx,Ry>::result_type
+ log_posterior_evaluator<T,D,M,Rx,Ry>::operator()(const P& p)const{
+ const super_& super = static_cast<const super_&>(*this);
+ result_type res = super(p);
+ res += log_unnormalized_pdf(
+ prior_model_dataset().prior(),
+ p
+ );
+ return res;
+ }
+
+ // Access
+ template<typename T,typename D,typename M,typename Rx,typename Ry>
+ const
+ typename
+ log_posterior_evaluator<T,D,M,Rx,Ry>::prior_model_dataset_type&
+ log_posterior_evaluator<T,D,M,Rx,Ry>::prior_model_dataset()const{
+ return (this->pmd_);
+ }
+
+}// model
+}// statistics
+}// boost
+
+#endif
\ No newline at end of file

Added: sandbox/statistics/model/boost/statistics/model/functional/log_prior_evaluator.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/model/boost/statistics/model/functional/log_prior_evaluator.hpp 2009-08-31 21:09:41 EDT (Mon, 31 Aug 2009)
@@ -0,0 +1,92 @@
+///////////////////////////////////////////////////////////////////////////////
+// model::functional::log_prior_evaluator.hpp //
+// //
+// Copyright 2009 Erwann Rogard. Distributed under the Boost //
+// Software License, Version 1.0. (See accompanying file //
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
+///////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_MODEL_FUNCTIONAL_LOG_PRIOR_EVALUATOR_HPP_ER_2009
+#define BOOST_MODEL_FUNCTIONAL_LOG_PRIOR_EVALUATOR_HPP_ER_2009
+#include <boost/range.hpp>
+#include <boost/statistics/model/wrap/unary/prior.hpp>
+
+namespace boost{
+namespace statistics{
+namespace model{
+
+ // Evaluates the log-likelihood at a parameter values given a model and
+ // a dataset.
+ //
+ // T is the result_type
+ template<typename T,typename D>
+ class log_prior_evaluator{
+ public:
+ typedef T result_type;
+ typedef prior_<D> prior_type;
+
+ // Constructor
+ log_prior_evaluator();
+ log_prior_evaluator(const prior_type&);
+ log_prior_evaluator(const log_prior_evaluator&);
+ log_prior_evaluator& operator=(const log_prior_evaluator&);
+
+ // Evaluate
+ template<typename P> result_type operator()(const P& p)const;
+
+ // Access
+ const prior_type& prior()const;
+
+ private:
+ prior_type p_;
+ };
+
+ // Implementation //
+
+ // Construction
+ template<typename T,typename D>
+ log_prior_evaluator<T,D>::log_prior_evaluator(){}
+
+ template<typename T,typename D>
+ log_prior_evaluator<T,D>::log_prior_evaluator(
+ const prior_type& p
+ ):p_(p){}
+
+ template<typename T,typename D>
+ log_prior_evaluator<T,D>::log_prior_evaluator(
+ const log_prior_evaluator& that
+ ):p_(that.p_){}
+
+ template<typename T,typename D>
+ log_prior_evaluator<T,D>&
+ log_prior_evaluator<T,D>::operator=(
+ const log_prior_evaluator& that
+ ){
+ if(&that!=this){
+ p_ = (that.p_);
+ }
+ return (*this);
+ }
+
+ // Evaluate
+ template<typename T,typename D>
+ template<typename P>
+ typename log_prior_evaluator<T,D>::result_type
+ log_prior_evaluator<T,D>::operator()(const P& p)const{
+ return log_unnormalized_pdf(
+ (this->prior()).prior(),
+ p
+ );
+ }
+
+ // Access
+ template<typename T,typename D>
+ const typename log_prior_evaluator<T,D>::prior_type&
+ log_prior_evaluator<T,D>::prior()const{
+ return (this->p_);
+ }
+
+}// model
+}// statistics
+}// boost
+
+#endif
\ No newline at end of file

Added: sandbox/statistics/model/boost/statistics/model/include.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/model/boost/statistics/model/include.hpp 2009-08-31 21:09:41 EDT (Mon, 31 Aug 2009)
@@ -0,0 +1,16 @@
+///////////////////////////////////////////////////////////////////////////////
+// model::include.hpp //
+// //
+// Copyright 2009 Erwann Rogard. Distributed under the Boost //
+// Software License, Version 1.0. (See accompanying file //
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
+///////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_STATISTICS_MODEL_INCLUDE_HPP_ER_2009
+#define BOOST_STATISTICS_MODEL_INCLUDE_HPP_ER_2009
+
+#include <boost/statistics/model/algorithm/include.hpp>
+#include <boost/statistics/model/wrap/include.hpp>
+#include <boost/statistics/model/functional/include.hpp>
+
+
+#endif
\ No newline at end of file

Added: sandbox/statistics/model/boost/statistics/model/wrap/aggregate/data.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/model/boost/statistics/model/wrap/aggregate/data.hpp 2009-08-31 21:09:41 EDT (Mon, 31 Aug 2009)
@@ -0,0 +1,60 @@
+///////////////////////////////////////////////////////////////////////////////
+// model::wrap::aggregate::data.hpp //
+// //
+// Copyright 2009 Erwann Rogard. Distributed under the Boost //
+// Software License, Version 1.0. (See accompanying file //
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
+///////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_STATISTICS_MODEL_WRAP_AGGREGATE_DATA_HPP_ER_2009
+#define BOOST_STATISTICS_MODEL_WRAP_AGGREGATE_DATA_HPP_ER_2009
+#include <boost/statistics/model/wrap/unary/covariate.hpp>
+#include <boost/statistics/model/wrap/unary/response.hpp>
+
+namespace boost{
+namespace statistics{
+namespace model{
+
+ template<typename X,typename Y>
+ class data_ :
+ public covariate_<X>,
+ public response_<Y>
+ {
+ typedef covariate_<X> cov_;
+ typedef response_<Y> resp_;
+
+ public:
+ typedef data_<X,Y> data_w_;
+
+ // Construction
+ data_();
+ data_(cov_ cov,resp_ resp);
+ data_(const data_&);
+
+ };
+
+ // Implementation //
+
+ template<typename X,typename Y>
+ data_<X,Y>::data_() : cov_(),resp_(){}
+
+ template<typename X,typename Y>
+ data_<X,Y>::data_( cov_ cov, resp_ resp ) : cov_( cov ), resp_( resp ){}
+
+ template<typename X,typename Y>
+ data_<X,Y>::data_(const data_& that)
+ :cov_( that ),resp_( that ) {}
+
+ // Free functions
+
+ template<typename X,typename Y>
+ data_<X,Y>
+ make_data(const X& x,const Y& y){
+ typedef data_<X,Y> result_type;
+ return result_type(x,y);
+ }
+
+}// model
+}// statistics
+}// boost
+
+#endif

Added: sandbox/statistics/model/boost/statistics/model/wrap/aggregate/dataset.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/model/boost/statistics/model/wrap/aggregate/dataset.hpp 2009-08-31 21:09:41 EDT (Mon, 31 Aug 2009)
@@ -0,0 +1,61 @@
+///////////////////////////////////////////////////////////////////////////////
+// model::wrap::aggregate::dataset.hpp //
+// //
+// Copyright 2009 Erwann Rogard. Distributed under the Boost //
+// Software License, Version 1.0. (See accompanying file //
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
+///////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_STATISTICS_MODEL_WRAP_AGGREGATE_DATASET_HPP_ER_2009
+#define BOOST_STATISTICS_MODEL_WRAP_AGGREGATE_DATASET_HPP_ER_2009
+#include <boost/statistics/model/wrap/unary/covariates.hpp>
+#include <boost/statistics/model/wrap/unary/responses.hpp>
+
+namespace boost{
+namespace statistics{
+namespace model{
+
+ template<typename Rx,typename Ry>
+ class dataset_ :
+ public covariates_<Rx>,
+ public responses_<Ry>
+ {
+ typedef covariates_<Rx> covs_;
+ typedef responses_<Ry> resps_;
+
+ public:
+ typedef dataset_<Rx,Ry> dataset_w_;
+
+ // Construction
+ dataset_();
+ dataset_(covs_ covs,resps_ resps);
+ dataset_(const dataset_&);
+
+ };
+
+ // Implementation //
+
+ template<typename Rx,typename Ry>
+ dataset_<Rx,Ry>::dataset_() : covs_(), resps_(){}
+
+ template<typename Rx,typename Ry>
+ dataset_<Rx,Ry>::dataset_( covs_ covs, resps_ resps)
+ : covs_( covs ), resps_( resps ){}
+
+ template<typename Rx,typename Ry>
+ dataset_<Rx,Ry>::dataset_(const dataset_& that)
+ :covs_( that ), resps_( that ) {}
+
+ // Free functions
+
+ template<typename Rx,typename Ry>
+ dataset_<Rx,Ry>
+ make_dataset(const Rx& rx,const Ry& ry){
+ typedef dataset_<Rx,Ry> result_type;
+ return result_type(rx,ry);
+ }
+
+}// model
+}// statistics
+}// boost
+
+#endif

Added: sandbox/statistics/model/boost/statistics/model/wrap/aggregate/model_covariate_parameter.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/model/boost/statistics/model/wrap/aggregate/model_covariate_parameter.hpp 2009-08-31 21:09:41 EDT (Mon, 31 Aug 2009)
@@ -0,0 +1,79 @@
+///////////////////////////////////////////////////////////////////////////////
+// model::wrap::aggregate::model_covariate_parameter.hpp //
+// //
+// Copyright 2009 Erwann Rogard. Distributed under the Boost //
+// Software License, Version 1.0. (See accompanying file //
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
+///////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_STATISTICS_MODEL_WRAP_AGGREGATE_MODEL_COVARIATE_PARAMETER_HPP_ER_2009
+#define BOOST_STATISTICS_MODEL_WRAP_AGGREGATE_MODEL_COVARIATE_PARAMETER_HPP_ER_2009
+#include <boost/statistics/model/wrap/aggregate/model_parameter.hpp>
+#include <boost/statistics/model/wrap/unary/covariate.hpp>
+
+namespace boost{
+namespace statistics{
+namespace model{
+
+ template<typename M,typename X,typename P>
+ class model_covariate_parameter_ :
+ public model_parameter_<M,P>,
+ public covariate_<X>
+ {
+ typedef model_parameter_<M,P> model_parameter_;
+ typedef covariate_<X> covariate_;
+
+ public:
+
+ typedef model_covariate_parameter_<M,X,P> model_covariate_parameter_w_;
+
+ // Construction
+ model_covariate_parameter_();
+ model_covariate_parameter_(model_parameter_ mp,covariate_ cov);
+ model_covariate_parameter_(
+ typename model_parameter_::model_w_ model,
+ covariate_ cov,
+ typename model_parameter_::parameter_w_ par
+ );
+ model_covariate_parameter_(const model_covariate_parameter_&);
+
+ };
+
+ // Implementation //
+
+ template<typename M,typename X,typename P>
+ model_covariate_parameter_<M,X,P>::model_covariate_parameter_()
+ : model_parameter_(),covariate_(){}
+
+ template<typename M,typename X,typename P>
+ model_covariate_parameter_<M,X,P>::model_covariate_parameter_(
+ model_parameter_ mp, covariate_ cov
+ )
+ : model_parameter_( mp ), covariate_( cov ){}
+
+ template<typename M,typename X,typename P>
+ model_covariate_parameter_<M,X,P>::model_covariate_parameter_(
+ typename model_parameter_::model_w_ m,
+ covariate_ cov,
+ typename model_parameter_::parameter_w_ p
+ )
+ : model_parameter_( m, p ), covariate_( cov ){}
+
+ template<typename M,typename X,typename P>
+ model_covariate_parameter_<M,X,P>::model_covariate_parameter_(
+ const model_covariate_parameter_& that
+ ) : model_parameter_( that ), covariate_( that ) {}
+
+ // Free functions
+
+ template<typename M,typename X,typename P>
+ model_covariate_parameter_<M,X,P>
+ make_model_covariate_parameter(const M& m,const X& x,const P& p){
+ typedef model_covariate_parameter_<M,X,P> result_type;
+ return result_type(m,x,p);
+ }
+
+}// model
+}// statistics
+}// boost
+
+#endif

Added: sandbox/statistics/model/boost/statistics/model/wrap/aggregate/model_data.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/model/boost/statistics/model/wrap/aggregate/model_data.hpp 2009-08-31 21:09:41 EDT (Mon, 31 Aug 2009)
@@ -0,0 +1,68 @@
+///////////////////////////////////////////////////////////////////////////////
+// model::wrap::aggregate::model_data.hpp //
+// //
+// Copyright 2009 Erwann Rogard. Distributed under the Boost //
+// Software License, Version 1.0. (See accompanying file //
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
+///////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_STATISTICS_MODEL_WRAP_AGGREGATE_MODEL_DATA_HPP_ER_2009
+#define BOOST_STATISTICS_MODEL_WRAP_AGGREGATE_MODEL_DATA_HPP_ER_2009
+#include <boost/statistics/model/wrap/unary/model.hpp>
+#include <boost/statistics/model/wrap/aggregate/data.hpp>
+
+namespace boost{
+namespace statistics{
+namespace model{
+
+ template<typename M,typename X,typename Y>
+ class model_data_ :
+ public model_<M>,
+ public data_<X,Y>
+ {
+ typedef model_<M> model_;
+ typedef data_<X,Y> data_;
+ public:
+ typedef model_data_<M,X,Y> model_data_w_;
+
+ // Construction
+ model_data_();
+ model_data_(model_ model,data_ data);
+ model_data_(
+ model_ model,
+ typename data_::covariate_w_ cov,
+ typename data_::response_w_ resp
+ );
+ model_data_(const model_data_&);
+
+ };
+
+ // Implementation //
+
+ template<typename M,typename X,typename Y>
+ model_data_<M,X,Y>::model_data_() : model_(),data_(){}
+
+ template<typename M,typename X,typename Y>
+ model_data_<M,X,Y>::model_data_(
+ model_ model,
+ typename data_::covariate_w_ covs,
+ typename data_::response_w_ resps
+ ) : model_( model ), data_ (covs,resps) {}
+
+ template<typename M,typename X,typename Y>
+ model_data_<M,X,Y>::model_data_(const model_data_& that)
+ :model_( that ),data_( that ) {}
+
+ // Free functions
+
+ template<typename M,typename X,typename Y>
+ model_data_<M,X,Y>
+ make_model_data(const M& m,const X& x,const Y& y){
+ typedef model_data_<M,X,Y> result_type;
+ return result_type(m,x,y);
+ }
+
+}// model
+}// statistics
+}// boost
+
+#endif

Added: sandbox/statistics/model/boost/statistics/model/wrap/aggregate/model_dataset.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/model/boost/statistics/model/wrap/aggregate/model_dataset.hpp 2009-08-31 21:09:41 EDT (Mon, 31 Aug 2009)
@@ -0,0 +1,68 @@
+///////////////////////////////////////////////////////////////////////////////
+// model::wrap::aggregate::model_dataset.hpp //
+// //
+// Copyright 2009 Erwann Rogard. Distributed under the Boost //
+// Software License, Version 1.0. (See accompanying file //
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
+///////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_STATISTICS_MODEL_WRAP_AGGREGATE_MODEL_DATASET_HPP_ER_2009
+#define BOOST_STATISTICS_MODEL_WRAP_AGGREGATE_MODEL_DATASET_HPP_ER_2009
+#include <boost/statistics/model/wrap/unary/model.hpp>
+#include <boost/statistics/model/wrap/aggregate/dataset.hpp>
+
+namespace boost{
+namespace statistics{
+namespace model{
+
+ template<typename M,typename Rx,typename Ry>
+ class model_dataset_ :
+ public model_<M>,
+ public dataset_<Rx,Ry>
+ {
+ typedef model_<M> model_;
+ typedef dataset_<Rx,Ry> dataset_;
+ public:
+ typedef model_dataset_<M,Rx,Ry> model_dataset_w_;
+
+ // Construction
+ model_dataset_();
+ model_dataset_(model_ model,dataset_ dataset);
+ model_dataset_(
+ model_ model,
+ typename dataset_::covariates_w_ covs,
+ typename dataset_::responses_w_ resps
+ );
+ model_dataset_(const model_dataset_&);
+
+ };
+
+ // Implementation //
+
+ template<typename M,typename Rx,typename Ry>
+ model_dataset_<M,Rx,Ry>::model_dataset_() : model_(),dataset_(){}
+
+ template<typename M,typename Rx,typename Ry>
+ model_dataset_<M,Rx,Ry>::model_dataset_(
+ model_ model,
+ typename dataset_::covariates_w_ covs,
+ typename dataset_::responses_w_ resps
+ ) : model_( model ), dataset_ (covs,resps) {}
+
+ template<typename M,typename Rx,typename Ry>
+ model_dataset_<M,Rx,Ry>::model_dataset_(const model_dataset_& that)
+ :model_( that ),dataset_( that ) {}
+
+ // Free functions
+
+ template<typename M,typename Rx,typename Ry>
+ model_dataset_<M,Rx,Ry>
+ make_model_dataset(const M& m,const Rx& rx,const Ry& ry){
+ typedef model_dataset_<M,Rx,Ry> result_type;
+ return result_type(m,rx,ry);
+ }
+
+}// model
+}// statistics
+}// boost
+
+#endif

Added: sandbox/statistics/model/boost/statistics/model/wrap/aggregate/model_parameter.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/model/boost/statistics/model/wrap/aggregate/model_parameter.hpp 2009-08-31 21:09:41 EDT (Mon, 31 Aug 2009)
@@ -0,0 +1,62 @@
+///////////////////////////////////////////////////////////////////////////////
+// model::wrap::aggregate::model_parameter.hpp //
+// //
+// Copyright 2009 Erwann Rogard. Distributed under the Boost //
+// Software License, Version 1.0. (See accompanying file //
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
+///////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_STATISTICS_MODEL_WRAP_AGGREGATE_MODEL_PARAMETER_HPP_ER_2009
+#define BOOST_STATISTICS_MODEL_WRAP_AGGREGATE_MODEL_PARAMETER_HPP_ER_2009
+#include <boost/statistics/model/wrap/unary/model.hpp>
+#include <boost/statistics/model/wrap/unary/parameter.hpp>
+
+namespace boost{
+namespace statistics{
+namespace model{
+
+ template<typename M,typename P>
+ class model_parameter_ :
+ public model_<M>,
+ public parameter_<P>
+ {
+ typedef model_<M> model_;
+ typedef parameter_<P> parameter_;
+
+ public:
+
+ typedef model_parameter_<M,P> model_parameter_w_;
+
+ // Construction
+ model_parameter_();
+ model_parameter_(model_ model,parameter_ par);
+ model_parameter_(const model_parameter_&);
+
+ };
+
+ // Implementation //
+
+ template<typename M,typename P>
+ model_parameter_<M,P>::model_parameter_() : model_(),parameter_(){}
+
+ template<typename M,typename P>
+ model_parameter_<M,P>::model_parameter_( model_ m, parameter_ p )
+ : model_( m ), parameter_( p ){}
+
+ template<typename M,typename P>
+ model_parameter_<M,P>::model_parameter_(const model_parameter_& that)
+ :model_( that ),parameter_( that ) {}
+
+ // Free functions
+
+ template<typename M,typename P>
+ model_parameter_<M,P>
+ make_model_parameter(const M& m,const P& p){
+ typedef model_parameter_<M,P> result_type;
+ return result_type(m,p);
+ }
+
+}// model
+}// statistics
+}// boost
+
+#endif

Added: sandbox/statistics/model/boost/statistics/model/wrap/aggregate/prior_model_dataset.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/model/boost/statistics/model/wrap/aggregate/prior_model_dataset.hpp 2009-08-31 21:09:41 EDT (Mon, 31 Aug 2009)
@@ -0,0 +1,73 @@
+///////////////////////////////////////////////////////////////////////////////
+// model::wrap::aggregate::prior_model_dataset.hpp //
+// //
+// Copyright 2009 Erwann Rogard. Distributed under the Boost //
+// Software License, Version 1.0. (See accompanying file //
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
+///////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_STATISTICS_MODEL_WRAP_AGGREGATE_PRIOR_MODEL_DATASET_HPP_ER_2009
+#define BOOST_STATISTICS_MODEL_WRAP_AGGREGATE_PRIOR_MODEL_DATASET_HPP_ER_2009
+#include <boost/statistics/model/wrap/unary/prior.hpp>
+#include <boost/statistics/model/wrap/aggregate/model_dataset.hpp>
+
+namespace boost{
+namespace statistics{
+namespace model{
+
+ template<typename D,typename M,typename Rx,typename Ry>
+ class prior_model_dataset_ :
+ public prior_<D>,
+ public model_dataset_<M,Rx,Ry>
+ {
+ typedef prior_<D> prior_;
+ typedef model_dataset_<M,Rx,Ry> model_dataset_;
+ public:
+ typedef prior_model_dataset_<D,M,Rx,Ry> prior_model_dataset_w_;
+
+ // Construction
+ prior_model_dataset_();
+ prior_model_dataset_(prior_ prior,model_dataset_ model_dataset);
+ prior_model_dataset_(
+ prior_ prior,
+ typename model_dataset_::model_w_ m,
+ typename model_dataset_::covariates_w_ covs,
+ typename model_dataset_::responses_w_ resps
+ );
+ prior_model_dataset_(const prior_model_dataset_&);
+
+ };
+
+ // Implementation //
+
+ template<typename D,typename M,typename Rx,typename Ry>
+ prior_model_dataset_<D,M,Rx,Ry>::prior_model_dataset_()
+ : prior_(),model_dataset_(){}
+
+ template<typename D,typename M,typename Rx,typename Ry>
+ prior_model_dataset_<D,M,Rx,Ry>::prior_model_dataset_(
+ prior_ prior,
+ typename model_dataset_::model_w_ m,
+ typename model_dataset_::covariates_w_ covs,
+ typename model_dataset_::responses_w_ resps
+ ) : prior_( prior ), model_dataset_ ( m, covs, resps) {}
+
+ template<typename D,typename M,typename Rx,typename Ry>
+ prior_model_dataset_<D,M,Rx,Ry>::prior_model_dataset_(
+ const prior_model_dataset_& that)
+ :prior_( that ),model_dataset_( that ) {}
+
+ // Free functions
+
+ template<typename D,typename M,typename Rx,typename Ry>
+ prior_model_dataset_<D,M,Rx,Ry>
+ make_prior_model_dataset(const D& d,const M& m,const Rx& rx,const Ry& ry){
+ typedef prior_model_dataset_<D,M,Rx,Ry> result_type;
+ return result_type(d,m,rx,ry);
+ }
+
+}// model
+}// statistics
+}// boost
+
+#endif
+

Added: sandbox/statistics/model/boost/statistics/model/wrap/include.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/model/boost/statistics/model/wrap/include.hpp 2009-08-31 21:09:41 EDT (Mon, 31 Aug 2009)
@@ -0,0 +1,24 @@
+///////////////////////////////////////////////////////////////////////////////
+// model::wrap::include.hpp //
+// //
+// Copyright 2009 Erwann Rogard. Distributed under the Boost //
+// Software License, Version 1.0. (See accompanying file //
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
+///////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_STATISTICS_MODEL_WRAP_INCLUDE_HPP_ER_2009
+#define BOOST_STATISTICS_MODEL_WRAP_INCLUDE_HPP_ER_2009
+
+#include <boost/statistics/model/wrap/unary/covariate.hpp>
+#include <boost/statistics/model/wrap/unary/model.hpp>
+#include <boost/statistics/model/wrap/unary/prior.hpp>
+#include <boost/statistics/model/wrap/unary/response.hpp>
+#include <boost/statistics/model/wrap/unary/covariates.hpp>
+#include <boost/statistics/model/wrap/unary/responses.hpp>
+
+#include <boost/statistics/model/wrap/aggregate/data.hpp>
+#include <boost/statistics/model/wrap/aggregate/dataset.hpp>
+#include <boost/statistics/model/wrap/aggregate/model_parameter.hpp>
+#include <boost/statistics/model/wrap/aggregate/model_dataset.hpp>
+#include <boost/statistics/model/wrap/aggregate/prior_model_dataset.hpp>
+
+#endif
\ No newline at end of file

Added: sandbox/statistics/model/boost/statistics/model/wrap/unary/covariate.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/model/boost/statistics/model/wrap/unary/covariate.hpp 2009-08-31 21:09:41 EDT (Mon, 31 Aug 2009)
@@ -0,0 +1,60 @@
+///////////////////////////////////////////////////////////////////////////////
+// model::wrap::unary::covariate.hpp //
+// //
+// Copyright 2009 Erwann Rogard. Distributed under the Boost //
+// Software License, Version 1.0. (See accompanying file //
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
+///////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_STATISTICS_MODEL_WRAP_UNARY_COVARIATE_HPP_ER_2009
+#define BOOST_STATISTICS_MODEL_WRAP_UNARY_COVARIATE_HPP_ER_2009
+#include <boost/statistics/model/wrap/unary/detail/base.hpp>
+
+namespace boost{
+namespace statistics{
+namespace model{
+
+ template<typename X>
+ class covariate_ : detail::base_<X>{
+ typedef detail::base_<X> base_;
+ public:
+ typedef X covariate_type;
+ typedef covariate_<X> covariate_w_;
+
+ // Construction
+ covariate_();
+ covariate_(const X& x);
+ covariate_(const covariate_&);
+
+ // Access
+ const X& covariate()const;
+ };
+
+ // Implementation //
+
+ template<typename X>
+ covariate_<X>::covariate_() : base_(){}
+
+ template<typename X>
+ covariate_<X>::covariate_( const X& x ) : base_(x){}
+
+ template<typename X>
+ covariate_<X>::covariate_(const covariate_& that)
+ :base_(that){}
+
+ template<typename X>
+ const X& covariate_<X>::covariate()const{ return (this->value); }
+
+ // Free functions
+
+ template<typename X>
+ covariate_<X>
+ make_covariate_(const X& x){
+ typedef covariate_<X> result_type;
+ return result_type(x);
+ }
+
+}// model
+}// statistics
+}// boost
+
+#endif

Added: sandbox/statistics/model/boost/statistics/model/wrap/unary/covariates.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/model/boost/statistics/model/wrap/unary/covariates.hpp 2009-08-31 21:09:41 EDT (Mon, 31 Aug 2009)
@@ -0,0 +1,60 @@
+///////////////////////////////////////////////////////////////////////////////
+// model::wrap::unary::covariates.hpp //
+// //
+// Copyright 2009 Erwann Rogard. Distributed under the Boost //
+// Software License, Version 1.0. (See accompanying file //
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
+///////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_STATISTICS_MODEL_WRAP_UNARY_COVARIATES_HPP_ER_2009
+#define BOOST_STATISTICS_MODEL_WRAP_UNARY_COVARIATES_HPP_ER_2009
+#include <boost/statistics/model/wrap/unary/detail/base.hpp>
+
+namespace boost{
+namespace statistics{
+namespace model{
+
+ template<typename Rx>
+ class covariates_ : detail::base_<Rx>{
+ typedef detail::base_<Rx> base_;
+ public:
+ typedef Rx covariates_type;
+ typedef covariates_<Rx> covariates_w_;
+
+ // Construction
+ covariates_();
+ covariates_(const Rx& x);
+ covariates_(const covariates_&);
+
+ // Access
+ const Rx& covariates()const;
+ };
+
+ // Implementation //
+
+ template<typename Rx>
+ covariates_<Rx>::covariates_() : base_(){}
+
+ template<typename Rx>
+ covariates_<Rx>::covariates_( const Rx& rx ) : base_(rx){}
+
+ template<typename Rx>
+ covariates_<Rx>::covariates_(const covariates_& that)
+ :base_(that){}
+
+ template<typename Rx>
+ const Rx& covariates_<Rx>::covariates()const{ return (this->value); }
+
+ // Free functions
+
+ template<typename Rx>
+ covariates_<Rx>
+ make_covariates(const Rx& rx){
+ typedef covariates_<Rx> result_type;
+ return result_type(rx);
+ }
+
+}// model
+}// statistics
+}// boost
+
+#endif

Added: sandbox/statistics/model/boost/statistics/model/wrap/unary/detail/base.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/model/boost/statistics/model/wrap/unary/detail/base.hpp 2009-08-31 21:09:41 EDT (Mon, 31 Aug 2009)
@@ -0,0 +1,61 @@
+///////////////////////////////////////////////////////////////////////////////
+// model::wrap::unary::detail::base.hpp //
+// //
+// Copyright 2009 Erwann Rogard. Distributed under the Boost //
+// Software License, Version 1.0. (See accompanying file //
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
+///////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_STATISTICS_MODEL_WRAP_UNARY_DETAIL_BASE_HPP_ER_2009
+#define BOOST_STATISTICS_MODEL_WRAP_UNARY_DETAIL_BASE_HPP_ER_2009
+#include <boost/mpl/assert.hpp>
+#include <boost/type_traits/is_reference.hpp>
+
+namespace boost{
+namespace statistics{
+namespace model{
+namespace detail{
+
+ // D represents the prior distribution
+ template<typename T>
+ class base_{
+ typedef is_reference<T> is_ref_;
+ BOOST_MPL_ASSERT((
+ mpl::not_<is_ref_>
+ ));
+ public:
+ // Construction
+ base_();
+ base_(const T&);
+ base_(const base_&);
+ const T& value;
+ private:
+ base_& operator=(const base_&);
+ static const T& make();
+ };
+
+ // Implementation //
+
+ template<typename T>
+ base_<T>::base_() : value(make()){}
+
+ template<typename T>
+ base_<T>::base_(
+ const T& t
+ ) : value(t){}
+
+ template<typename T>
+ base_<T>::base_(const base_& that)
+ :value( that.value ){}
+
+ template<typename T>
+ const T& base_<T>::make(){
+ static T t = T();
+ return t;
+ }
+
+}// detail
+}// model
+}// statistics
+}// boost
+
+#endif

Added: sandbox/statistics/model/boost/statistics/model/wrap/unary/model.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/model/boost/statistics/model/wrap/unary/model.hpp 2009-08-31 21:09:41 EDT (Mon, 31 Aug 2009)
@@ -0,0 +1,60 @@
+///////////////////////////////////////////////////////////////////////////////
+// model::wrap::unary::model.hpp //
+// //
+// Copyright 2009 Erwann Rogard. Distributed under the Boost //
+// Software License, Version 1.0. (See accompanying file //
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
+///////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_STATISTICS_MODEL_WRAP_UNARY_MODEL_HPP_ER_2009
+#define BOOST_STATISTICS_MODEL_WRAP_UNARY_MODEL_HPP_ER_2009
+#include <boost/statistics/model/wrap/unary/detail/base.hpp>
+
+namespace boost{
+namespace statistics{
+namespace model{
+
+ template<typename M>
+ class model_ : detail::base_<M>{
+ typedef detail::base_<M> base_;
+ public:
+ typedef M model_type;
+ typedef model_<M> model_w_;
+
+ // Construction
+ model_();
+ model_(const M& m);
+ model_(const model_&);
+
+ // Access
+ const M& model()const;
+ };
+
+ // Implementation //
+
+ template<typename M>
+ model_<M>::model_() : base_(){}
+
+ template<typename M>
+ model_<M>::model_( const M& m ) : base_(m){}
+
+ template<typename M>
+ model_<M>::model_(const model_& that)
+ :base_(that){}
+
+ template<typename M>
+ const M& model_<M>::model()const{ return (this->value); }
+
+ // Free functions
+
+ template<typename M>
+ model_<M>
+ make_model(const M& m){
+ typedef model_<M> result_type;
+ return result_type(m);
+ }
+
+}// model
+}// statistics
+}// boost
+
+#endif

Added: sandbox/statistics/model/boost/statistics/model/wrap/unary/parameter.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/model/boost/statistics/model/wrap/unary/parameter.hpp 2009-08-31 21:09:41 EDT (Mon, 31 Aug 2009)
@@ -0,0 +1,60 @@
+///////////////////////////////////////////////////////////////////////////////
+// model::wrap::unary::parameter.hpp //
+// //
+// Copyright 2009 Erwann Rogard. Distributed under the Boost //
+// Software License, Version 1.0. (See accompanying file //
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
+///////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_STATISTICS_MODEL_WRAP_UNARY_PARAMETER_HPP_ER_2009
+#define BOOST_STATISTICS_MODEL_WRAP_UNARY_PARAMETER_HPP_ER_2009
+#include <boost/statistics/model/wrap/unary/detail/base.hpp>
+
+namespace boost{
+namespace statistics{
+namespace model{
+
+ template<typename X>
+ class parameter_ : detail::base_<X>{
+ typedef detail::base_<X> base_;
+ public:
+ typedef X parameter_type;
+ typedef parameter_<X> parameter_w_;
+
+ // Construction
+ parameter_();
+ parameter_(const X& x);
+ parameter_(const parameter_&);
+
+ // Access
+ const X& parameter()const;
+ };
+
+ // Implementation //
+
+ template<typename X>
+ parameter_<X>::parameter_() : base_(){}
+
+ template<typename X>
+ parameter_<X>::parameter_( const X& x ) : base_(x){}
+
+ template<typename X>
+ parameter_<X>::parameter_(const parameter_& that)
+ :base_(that){}
+
+ template<typename X>
+ const X& parameter_<X>::parameter()const{ return (this->value); }
+
+ // Free functions
+
+ template<typename X>
+ parameter_<X>
+ make_parameter(const X& x){
+ typedef parameter_<X> result_type;
+ return result_type(x);
+ }
+
+}// model
+}// statistics
+}// boost
+
+#endif

Added: sandbox/statistics/model/boost/statistics/model/wrap/unary/prior.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/model/boost/statistics/model/wrap/unary/prior.hpp 2009-08-31 21:09:41 EDT (Mon, 31 Aug 2009)
@@ -0,0 +1,61 @@
+///////////////////////////////////////////////////////////////////////////////
+// prior::wrap::unary::prior.hpp //
+// //
+// Copyright 2009 Erwann Rogard. Distributed under the Boost //
+// Software License, Version 1.0. (See accompanying file //
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
+///////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_STATISTICS_MODEL_WRAP_UNARY_PRIOR_HPP_ER_2009
+#define BOOST_STATISTICS_MODEL_WRAP_UNARY_PRIOR_HPP_ER_2009
+#include <boost/statistics/model/wrap/unary/detail/base.hpp>
+
+namespace boost{
+namespace statistics{
+namespace model{
+
+ template<typename D>
+ class prior_ : detail::base_<D>{
+ typedef detail::base_<D> base_;
+ public:
+ typedef D prior_type;
+ typedef prior_<D> prior_w_;
+
+
+ // Construction
+ prior_();
+ prior_(const D& d);
+ prior_(const prior_&);
+
+ // Access
+ const D& prior()const;
+ };
+
+ // Implementation //
+
+ template<typename D>
+ prior_<D>::prior_() : base_(){}
+
+ template<typename D>
+ prior_<D>::prior_( const D& d ) : base_(d){}
+
+ template<typename D>
+ prior_<D>::prior_(const prior_& that)
+ :base_(that){}
+
+ template<typename D>
+ const D& prior_<D>::prior()const{ return (this->value); }
+
+ // Free functions
+
+ template<typename D>
+ prior_<D>
+ make_prior(const D& d){
+ typedef prior_<D> result_type;
+ return result_type(d);
+ }
+
+}// prior
+}// statistics
+}// boost
+
+#endif

Added: sandbox/statistics/model/boost/statistics/model/wrap/unary/response.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/model/boost/statistics/model/wrap/unary/response.hpp 2009-08-31 21:09:41 EDT (Mon, 31 Aug 2009)
@@ -0,0 +1,60 @@
+///////////////////////////////////////////////////////////////////////////////
+// model::wrap::unary::response.hpp //
+// //
+// Copyright 2009 Erwann Rogard. Distributed under the Boost //
+// Software License, Version 1.0. (See accompanying file //
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
+///////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_STATISTICS_MODEL_WRAP_UNARY_RESPONSE_HPP_ER_2009
+#define BOOST_STATISTICS_MODEL_WRAP_UNARY_RESPONSE_HPP_ER_2009
+#include <boost/statistics/model/wrap/unary/detail/base.hpp>
+
+namespace boost{
+namespace statistics{
+namespace model{
+
+ template<typename Y>
+ class response_ : detail::base_<Y>{
+ typedef detail::base_<Y> base_;
+ public:
+ typedef Y response_type;
+ typedef response_<Y> response_w_;
+
+ // Construction
+ response_();
+ response_(const Y& y);
+ response_(const response_&);
+
+ // Access
+ const Y& response()const;
+ };
+
+ // Implementation //
+
+ template<typename Y>
+ response_<Y>::response_() : base_(){}
+
+ template<typename Y>
+ response_<Y>::response_( const Y& y ) : base_(y){}
+
+ template<typename Y>
+ response_<Y>::response_(const response_& that)
+ :base_(that){}
+
+ template<typename Y>
+ const Y& response_<Y>::response()const{ return (this->value); }
+
+ // Free functions
+
+ template<typename Y>
+ response_<Y>
+ make_response(const Y& y){
+ typedef response_<Y> result_type;
+ return result_type(y);
+ }
+
+}// model
+}// statistics
+}// boost
+
+#endif

Added: sandbox/statistics/model/boost/statistics/model/wrap/unary/responses.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/model/boost/statistics/model/wrap/unary/responses.hpp 2009-08-31 21:09:41 EDT (Mon, 31 Aug 2009)
@@ -0,0 +1,60 @@
+///////////////////////////////////////////////////////////////////////////////
+// model::wrap::unary::responses.hpp //
+// //
+// Copyright 2009 Erwann Rogard. Distributed under the Boost //
+// Software License, Version 1.0. (See accompanying file //
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
+///////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_STATISTICS_MODEL_WRAP_UNARY_RESPONSES_HPP_ER_2009
+#define BOOST_STATISTICS_MODEL_WRAP_UNARY_RESPONSES_HPP_ER_2009
+#include <boost/statistics/model/wrap/unary/detail/base.hpp>
+
+namespace boost{
+namespace statistics{
+namespace model{
+
+ template<typename Ry>
+ class responses_ : detail::base_<Ry>{
+ typedef detail::base_<Ry> base_;
+ public:
+ typedef Ry responses_type;
+ typedef responses_<Ry> responses_w_;
+
+ // Construction
+ responses_();
+ responses_(const Ry& x);
+ responses_(const responses_&);
+
+ // Access
+ const Ry& responses()const;
+ };
+
+ // Implementation //
+
+ template<typename Ry>
+ responses_<Ry>::responses_() : base_(){}
+
+ template<typename Ry>
+ responses_<Ry>::responses_( const Ry& ry ) : base_(ry){}
+
+ template<typename Ry>
+ responses_<Ry>::responses_(const responses_& that)
+ :base_(that){}
+
+ template<typename Ry>
+ const Ry& responses_<Ry>::responses()const{ return (this->value); }
+
+ // Free functions
+
+ template<typename Ry>
+ responses_<Ry>
+ make_responses(const Ry& ry){
+ typedef responses_<Ry> result_type;
+ return result_type(ry);
+ }
+
+}// model
+}// statistics
+}// boost
+
+#endif

Added: sandbox/statistics/model/libs/statistics/model/doc/readme.txt
==============================================================================
--- (empty file)
+++ sandbox/statistics/model/libs/statistics/model/doc/readme.txt 2009-08-31 21:09:41 EDT (Mon, 31 Aug 2009)
@@ -0,0 +1,112 @@
+//////////////////////////////////////////////////////////////////////////////
+// statistics::modeldoc::readme //
+// //
+// (C) Copyright 2009 Erwann Rogard //
+// Use, modification and distribution are subject to the //
+// Boost Software License, Version 1.0. (See accompanying file //
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
+//////////////////////////////////////////////////////////////////////////////
+
+[ Contact ]
+
+erwann.rogard_at_[hidden]
+
+[ Overview ]
+
+This C++ package contains
+
+i) Wrappers are individual or bundled references to quantities such as data,
+parameters and model abstractions, that arise in frequentist or Bayesian
+modeling. They give explicit meaning to the above quantities and simplify the
+syntax of functions that takes these quantities as arguments.
+
+ii) STL-like algorithms for computing likelihoods or posterior distributions,
+by aggretating the contributions of data-units in an (for now) iid setting.
+
+Examples can be found in statistics/survival/libs/example
+
+[ Compiler ]
+
+gcc version i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1
+
+[ Dependencies ]
+
+/boost_1_39_0/
+
+/sandbox/statistics/scalar_dist/
+/sandbox/statistics/joint_dist/
+/sandbox/statistics/binary_op/
+
+[ History ]
+
+July 2009 : Current version
+
+[ Notation ]
+
+LPdf and Model are concepts defined within this package.
+
+ Type Object Abstraction Concept
+ name name
+ - T t scalar is_scalar
+ - X x covariate
+ - Y y response
+ - P p parameter
+ - D d prior distribution LPdf
+ - M m likelihood model Model
+ - Rx rx covariates ForwardRange
+ - Ry ry responses ForwardRange
+ - O o OutputIterator
+
+Note that X, Y, P are not retricted to scalars. For example,
+ X == std::vector<T>
+ Y == survival::data::event<T>
+
+ Class Alias Object name
+ model_parameter_<M,P> mp_ mp
+ model_dataset_<M,Rx,Ry> md_ md
+ prior_model_dataset_<D,M,Rx,Ry> pmd_ pmd
+
+[b_x,e_x) and [b_p,e_p) denote iterator ranges to covariates and
+parameter values, respectively.
+
+[ Concepts ]
+
+- Model
+ m models Model iff
+ Expression Return type
+ log_likelihood(make_model_data(m,x,y),p) T
+- LPdf
+ d models LPdf iff
+ Expression Returns
+ log_unnormalized_pdf(d,p) T
+
+Those D such that is_scalar_dist<D> or joint_dist<D> evaluates to true model
+LPdf. Check directory unscope in either package.
+
+[ wrap ]
+ Example of wrappers:
+ md_ md(m,rx,ry);
+ md.covariates();
+
+ Often we only need a temporary, in which case it is preferable to call an
+ associated creator function that deduces the types of its arguments:
+ make_model_dataset(m,rx,ry);
+
+[ functional ]
+ Functors that support [ algorithm ]
+
+[ algorithm ]
+ Iterate over a dataset or parameter values to produce a likelihood or
+ set of likelihood (or posterior) values
+
+ Expression Return type
+ log_likelihood(mp,b_x,e_x,b_y) T
+ log_likelihoods(md,b_p,e_p,o) O
+ log_posteriors(pmd,b_p,e_p,o) O
+
+[ TODO ]
+
+- Some simple examples.
+- Check integration with Boost.Probability i.e. T = boost::log_likelihood
+- Think about non-iid
+- Think about derivatives.
\ No newline at end of file


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk