Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r72910 - in sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric: contingency_table/cells contingency_table/detail contingency_table/factor contingency_table/include contingency_table/include/pearson_chisq contingency_table/pearson_chisq/common contingency_table/pearson_chisq/independence empirical_distribution kolmogorov_smirnov
From: erwann.rogard_at_[hidden]
Date: 2011-07-05 07:21:14


Author: e_r
Date: 2011-07-05 07:21:10 EDT (Tue, 05 Jul 2011)
New Revision: 72910
URL: http://svn.boost.org/trac/boost/changeset/72910

Log:
rm obsolete directory
Removed:
   sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/empirical_distribution/
Text files modified:
   sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/cells/cells.hpp | 115 +++++++++++++++++++----------------
   sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/cells/cells_count.hpp | 48 +++++++++-----
   sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/cells/count_matching.hpp | 42 ++++++++-----
   sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/cells/marginal_cells.hpp | 4
   sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/cells/non_empty_cells_count.hpp | 17 ++++-
   sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/detail/policy_keyword.hpp | 5 +
   sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/factor/check_against_domain.hpp | 8 -
   sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/factor/domain_error_logger.hpp | 2
   sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/factor/filter.hpp | 4
   sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/factor/keyword.hpp | 15 ++--
   sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/factor/levels.hpp | 40 ++++++++----
   sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/factor/vec_levels.hpp | 5 -
   sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/include/cells.hpp | 5 +
   sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/include/pearson_chisq/common.hpp | 16 ----
   sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/include/pearson_chisq/independence.hpp | 5
   sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/common/asy_distribution.hpp | 60 ------------------
   sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/common/chisq_summand_formula.hpp | 36 -----------
   sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/common/df_formula.hpp | 41 ------------
   sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/independence/depends_on.hpp | 12 +--
   sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/independence/df.hpp | 36 -----------
   sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/independence/impl.hpp | 45 -------------
   sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/independence/lost_df.hpp | 73 ----------------------
   sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/independence/statistic.hpp | 127 ---------------------------------------
   sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/independence/tag.hpp | 40 ------------
   sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/kolmogorov_smirnov/check_convergence.hpp | 52 +++++++++------
   sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/kolmogorov_smirnov/statistic.hpp | 12 +-
   26 files changed, 234 insertions(+), 631 deletions(-)

Modified: sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/cells/cells.hpp
==============================================================================
--- sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/cells/cells.hpp (original)
+++ sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/cells/cells.hpp 2011-07-05 07:21:10 EDT (Tue, 05 Jul 2011)
@@ -7,9 +7,6 @@
 ///////////////////////////////////////////////////////////////////////////////
 #ifndef BOOST_STATISTICS_DETAIL_NON_PARAMETRIC_CONTINGENCY_TABLE_CELLS_CELLS_HPP_ER_2010
 #define BOOST_STATISTICS_DETAIL_NON_PARAMETRIC_CONTINGENCY_TABLE_CELLS_CELLS_HPP_ER_2010
-#include <boost/type_traits/remove_reference.hpp>
-#include <boost/type_traits/remove_const.hpp>
-
 #include <boost/math/policies/policy.hpp>
 
 #include <boost/fusion/include/at_key.hpp>
@@ -27,8 +24,8 @@
 #include <boost/accumulators/statistics_fwd.hpp>
 #include <boost/accumulators/framework/parameters/weight.hpp>
 #include <boost/accumulators/framework/detail/unpack_depends_on.hpp>
+#include <boost/accumulators/framework/detail/parameters/policy.hpp>
 
-#include <boost/statistics/detail/non_parametric/contingency_table/detail/policy_keyword.hpp>
 #include <boost/statistics/detail/non_parametric/contingency_table/detail/raise_domain_error.hpp>
 #include <boost/statistics/detail/non_parametric/contingency_table/factor/levels.hpp>
 #include <boost/statistics/detail/non_parametric/contingency_table/factor/vec_levels.hpp>
@@ -44,69 +41,95 @@
 namespace statistics{
 namespace detail{
 namespace contingency_table{
-namespace cells{
+namespace cells_aux{
 
    template<typename Keys>
- struct cells_depends_on{
- typedef typename factor::vec_levels<Keys>::type vec_levels_;
+ struct depends_on{
+ typedef typename contingency_table::vec_levels<Keys>::type vec_levels_;
         typedef typename boost::accumulators::detail::unpack_depends_on<
             vec_levels_
>::type type;
    };
 
- template<typename T,typename Keys>
- struct cells_traits{
+ template<typename T,typename Keys,typename W>
+ struct traits{
         typedef boost::fusion::detail::map_subset_traits<T,Keys> inner_traits;
         typedef typename inner_traits::map subsample_;
         typedef boost::fusion::detail::hashable_map<
             subsample_> hashable_subsample_;
         typedef typename boost::unordered_map<
- hashable_subsample_,std::size_t> map_;
+ hashable_subsample_,W> map_;
         
     };
 
+}// cells_aux
 namespace impl{
 
- template<typename T,typename Keys>
+ // TODO rename weighted_count to cumulative_weight.
+
+ template<typename T,typename Keys,typename W>
     class cells : public boost::accumulators::accumulator_base{
         typedef boost::accumulators::dont_care dont_care_;
         typedef std::size_t size_;
                 
- typedef contingency_table::cells::cells_traits<T,Keys> traits_;
+ typedef contingency_table::cells_aux::traits<T,Keys,W> traits_;
         typedef typename traits_::hashable_subsample_ hashable_subsample_;
         typedef typename traits_::map_ map_;
         
         public:
                 
         typedef T sample_type;
- typedef size_ size_type;
+ typedef W size_type;
 
         typedef map_& result_type; // not const bec map[] is non-const
 
- cells(dont_care_){}
-
- template<typename A1,typename A2>
- void operator()(const A1& a1,const A2& a2){
+ cells(dont_care_){
+
+ // Calling
+ // initialize<Keys>(
+ // args[ boost::accumulators::accumulator ]
+ // );
+ // in this scope would cause EXC_BAD_ACCESS and MUST be called from
+ // outside.
             
         }
 
         template<typename Args>
         void operator()(const Args& args){
- namespace ns = boost::statistics::detail;
             typedef boost::math::policies::policy<> pol_;
+ namespace ac = boost::accumulators;
             this->update_if(
- hashable_subsample_( args[boost::accumulators::sample] ),
- args[ boost::accumulators::accumulator ],
- args[ ns::_policy | pol_() ],
- args[boost::accumulators::weight]
+ hashable_subsample_( args[ boost::accumulators::sample ] ),
+ args[ ac::accumulator ],
+ args[ ac::detail::_policy | pol_() ],
+ args[ ac::weight ]
             );
         }
                 
- result_type result(dont_care_)const{
- return this->map;
- }
+ result_type result(dont_care_)const{ return this->map; }
 
                 private:
+ template<typename V,typename N>
+ void update(
+ const V& s,
+ const N& size
+ ){
+ ( this->map )[ s ] += size;
+ }
+
+ typedef ::boost::math::policies::domain_error<
+ boost::math::policies::ignore_error
+ > ignore_policy_;
+ template<typename V,typename A,typename N>
+ void update_if(
+ const V& s,
+ const A& acc,
+ const ignore_policy_& policy,
+ const N& size
+ ){
+ this->update(s,acc,size);
+ }
+
         template<typename V,typename A,typename P,typename N>
         void update_if(
             const V& s,
@@ -114,18 +137,18 @@
             const P& policy,
             const N& size
         ){
+ namespace ct = contingency_table;
             this->error_logger.reset();
             boost::fusion::for_each(
                 s,
- factor::make_check_against_domain( acc, this->error_logger)
+ ct::make_check_against_domain( acc, this->error_logger)
             );
             if(!this->error_logger.is_error())
             {
- ( this->map )[ s ] += size;
+ this->update( s, size );
             }else{
- namespace ns = contingency_table;
                 static const char* fun = "impl::cells::update_if %1%";
- ns::raise_domain_error<V>(
+ ct::raise_domain_error<V>(
                   fun,
                   this->error_logger().c_str(),
                   policy
@@ -134,7 +157,7 @@
         }
 
         mutable map_ map;
- typedef contingency_table::factor::domain_error_logger error_logger_;
+ typedef contingency_table::domain_error_logger error_logger_;
         error_logger_ error_logger;
         };
     
@@ -144,15 +167,14 @@
 
     template<typename Keys>
     struct cells
- : contingency_table::cells::cells_depends_on<Keys>::type
+ : contingency_table::cells_aux::depends_on<Keys>::type
     {
- typedef typename factor::par_spec< Keys >::type par_spec_;
+ typedef typename contingency_table::par_spec< Keys >::type par_spec_;
     
         struct impl{
             template<typename T,typename W>
             struct apply{
- typedef contingency_table
- ::cells::impl::cells<T,Keys> type;
+ typedef contingency_table::impl::cells<T,Keys,W> type;
             };
         };
     };
@@ -165,39 +187,26 @@
     struct cells
     : boost::accumulators::detail::extractor_result<
         AccSet,
- contingency_table::cells::tag::cells<Keys>
+ contingency_table::tag::cells<Keys>
>{};
-
+
 }// extract
 }// result_of
-namespace extract
-{
-
- // Usage :
- // cells<Key>(acc,policy)
- template<typename Keys,typename P,typename AccSet>
- typename contingency_table::cells::result_of::extract::template
- cells<Keys,AccSet>::type
- cells(AccSet const& acc,const P& policy)
- {
- typedef contingency_table::cells::tag::cells<Keys> the_tag;
- return boost::accumulators::extract_result<the_tag>(acc,policy);
- }
+namespace extract{
 
           template<typename Keys,typename AccSet>
- typename contingency_table::cells::result_of::extract::template
+ typename contingency_table::result_of::extract::template
         cells<Keys,AccSet>::type
           cells(AccSet const& acc)
     {
- typedef boost::math::policies::policy<> policy_;
- return extract::cells<Keys>(acc,policy_());
+ typedef contingency_table::tag::cells<Keys> the_tag;
+ return boost::accumulators::extract_result<the_tag>( acc );
           }
 
 }// extract
 
 using extract::cells;
 
-}// cells
 }// contingency_table
 }// detail
 }// statistics

Modified: sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/cells/cells_count.hpp
==============================================================================
--- sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/cells/cells_count.hpp (original)
+++ sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/cells/cells_count.hpp 2011-07-05 07:21:10 EDT (Tue, 05 Jul 2011)
@@ -11,47 +11,61 @@
 #include <boost/mpl/placeholders.hpp>
 #include <boost/mpl/detail/wrapper.hpp>
 #include <boost/statistics/detail/non_parametric/contingency_table/factor/levels.hpp>
+#include <boost/statistics/detail/non_parametric/contingency_table/cells/traits.hpp>
 
 namespace boost{
 namespace statistics{
 namespace detail{
 namespace contingency_table{
-namespace cells{
+namespace cells_aux{
 
- template<typename A>
- struct cells_count_aux{
+ // The total number of cells is the cross product of the number of levels
+ // for each variable. For example, if there are 3 rows and 4 columns,
+ // there are 3 x 4 = 12 cells.
+ template<typename A,typename N>
+ struct count{
     
- typedef std::size_t size_;
+ typedef N size_;
         typedef void result_type;
     
- cells_count_aux(const A& acc,size_& n)
+ count(const A& acc,size_& n)
         :acc_( acc ),n_( n ){}
         
         template<typename Key>
- void operator()(const boost::statistics::detail::mpl_wrapper<Key>& u){
- this->n_ *= factor::levels<Key>( this->acc_ ).size();
+ void operator()(const boost::mpl::detail::wrapper<Key>& u){
+ this->n_ *= contingency_table::levels<Key>( this->acc_ ).size();
         }
         
         const A& acc_;
- size_& n_;
+ N& n_;
     };
+
+}// cells_aux
+namespace result_of{
+
+ template<typename Keys,typename AccSet>
+ struct cells_count : contingency_table::cells_traits::size_of<
+ Keys,AccSet>{};
+
+}// result_of
 
           template<typename Keys,typename AccSet>
- std::size_t cells_count(AccSet const& acc){
+ typename contingency_table::result_of::cells_count<Keys,AccSet>::type
+ cells_count(AccSet const& acc)
+ {
         namespace ns = statistics::detail;
- typedef ns::mpl_wrapper<boost::mpl::_> op_;
- typedef cells::cells_count_aux<AccSet> fun_;
- std::size_t n = 1;
- boost::mpl::for_each<Keys,op_>(
- fun_( acc, n )
- );
+ typedef boost::mpl::detail::wrapper<boost::mpl::_> op_;
+ typedef typename contingency_table::result_of::cells_count<
+ Keys,AccSet>::type size_;
+ typedef contingency_table::cells_aux::count<AccSet,size_> fun_;
+ size_ n = 1;
+ boost::mpl::for_each<Keys,op_>( fun_( acc, n ) );
         return n;
     }
 
-}// cells
 }// contingency_table
 }// detail
 }// statistics
 }// boost
 
-#endif
\ No newline at end of file
+#endif

Modified: sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/cells/count_matching.hpp
==============================================================================
--- sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/cells/count_matching.hpp (original)
+++ sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/cells/count_matching.hpp 2011-07-05 07:21:10 EDT (Tue, 05 Jul 2011)
@@ -10,35 +10,45 @@
 #include <boost/mpl/assert.hpp>
 #include <boost/type_traits/is_same.hpp>
 #include <boost/statistics/detail/non_parametric/contingency_table/cells/cells.hpp>
+#include <boost/statistics/detail/non_parametric/contingency_table/cells/traits.hpp>
 #include <boost/mpl/detail/wrapper.hpp>
 
 namespace boost{
 namespace statistics{
 namespace detail{
 namespace contingency_table{
-namespace cells{
+namespace result_of{
+
+ template<typename Keys,typename AccSet>
+ struct count_matching
+ : contingency_table::cells_traits::mapped_of<Keys, AccSet>{};
+
+}// result_of
+
 
           template<typename Keys,typename AccSet,typename T>
- std::size_t count_matching(AccSet const& acc,const T& sample){
- return cells::extract::cells<Keys>( acc )[ sample ];
+ typename contingency_table::result_of::count_matching<Keys,AccSet>::type
+ count_matching(AccSet const& acc,const T& sample){
+ namespace ns = contingency_table;
+ return ns::extract::cells<Keys>( acc )[ sample ];
     }
 
     // A: accumulator set
- // S: sample
+ // T: sample
     // F: unary functor
- template<typename A,typename S,typename F>
- struct count_matching_aux{
+ template<typename A,typename T,typename F>
+ struct fun_count_matcher{
             
- typedef std::size_t size_;
         typedef void result_type;
     
- count_matching_aux(const A& a,const S& s, const F& f)
+ fun_count_matcher(const A& a,const T& s, const F& f)
             :acc( a ), sample( s ), fun( f ){}
         
         template<typename Keys>
- void operator()(const statistics::detail::mpl_wrapper<Keys>& u)const{
+ void operator()(const boost::mpl::detail::wrapper<Keys>& u)const{
+ namespace ns = contingency_table;
             this->fun(
- cells::count_matching<Keys>(
+ ns::count_matching<Keys>(
                     this->acc,
                     this->sample
                 )
@@ -47,18 +57,18 @@
         
         private:
         const A& acc;
- const S& sample;
+ const T& sample;
         F fun;
     };
 
- template<typename A,typename S,typename F>
- count_matching_aux<A,S,F>
- make_count_matching_aux(const A& a,const S& s, const F& f){
- typedef count_matching_aux<A,S,F> result_;
+ template<typename A,typename T,typename F>
+ fun_count_matcher<A,T,F>
+ make_fun_count_matcher(const A& a,const T& s, const F& f){
+ namespace ns = contingency_table;
+ typedef ns::fun_count_matcher<A,T,F> result_;
         return result_(a, s, f);
     }
 
-}// cells
 }// contingency_table
 }// detail
 }// statistics

Modified: sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/cells/marginal_cells.hpp
==============================================================================
--- sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/cells/marginal_cells.hpp (original)
+++ sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/cells/marginal_cells.hpp 2011-07-05 07:21:10 EDT (Tue, 05 Jul 2011)
@@ -18,7 +18,6 @@
 namespace statistics{
 namespace detail{
 namespace contingency_table{
-namespace cells{
 
     template<typename Keys>
     struct marginal_cells : boost::mpl::fold<
@@ -26,13 +25,12 @@
         boost::mpl::vector0<>,
         boost::mpl::push_back<
             boost::mpl::_1,
- contingency_table::cells::tag::cells<
+ contingency_table::tag::cells<
                 boost::mpl::vector1<boost::mpl::_2>
>
>
>{};
 
-}// cells
 }// contingency_table
 }// detail
 }// statistics

Modified: sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/cells/non_empty_cells_count.hpp
==============================================================================
--- sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/cells/non_empty_cells_count.hpp (original)
+++ sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/cells/non_empty_cells_count.hpp 2011-07-05 07:21:10 EDT (Tue, 05 Jul 2011)
@@ -9,19 +9,28 @@
 #define BOOST_STATISTICS_DETAIL_NON_PARAMETRIC_CONTINGENCY_TABLE_CELLS_NON_EMPTY_CELLS_COUNT_HPP_ER_2010
 #include <boost/range.hpp>
 #include <boost/statistics/detail/non_parametric/contingency_table/cells/cells.hpp>
+#include <boost/statistics/detail/non_parametric/contingency_table/cells/traits.hpp>
 
 namespace boost{
 namespace statistics{
 namespace detail{
 namespace contingency_table{
-namespace cells{
+namespace result_of{
+
+ template<typename Keys,typename AccSet>
+ struct non_empty_cells_count
+ : contingency_table::cells_traits::size_of<Keys,AccSet>{};
+
+}// result_of
 
           template<typename Keys,typename AccSet>
- std::size_t non_empty_cells_count(AccSet const& acc){
- return cells::extract::cells<Keys>(acc).size() ;
+ typename contingency_table::result_of::non_empty_cells_count<
+ Keys,AccSet>::type
+ non_empty_cells_count(AccSet const& acc){
+ namespace ns = contingency_table;
+ return ns::extract::cells<Keys>( acc ).size() ;
     }
 
-}// cells
 }// contingency_table
 }// detail
 }// statistics

Modified: sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/detail/policy_keyword.hpp
==============================================================================
--- sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/detail/policy_keyword.hpp (original)
+++ sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/detail/policy_keyword.hpp 2011-07-05 07:21:10 EDT (Tue, 05 Jul 2011)
@@ -1,3 +1,4 @@
+/*
 ///////////////////////////////////////////////////////////////////////////////
 // policy_keyword.hpp //
 // //
@@ -21,4 +22,6 @@
 }// statistics
 }// boost
 
-#endif
\ No newline at end of file
+
+#endif
+*/
\ No newline at end of file

Modified: sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/factor/check_against_domain.hpp
==============================================================================
--- sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/factor/check_against_domain.hpp (original)
+++ sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/factor/check_against_domain.hpp 2011-07-05 07:21:10 EDT (Tue, 05 Jul 2011)
@@ -14,7 +14,6 @@
 namespace statistics{
 namespace detail{
 namespace contingency_table{
-namespace factor{
 
     template<typename A,typename E>
     struct check_against_domain{
@@ -29,7 +28,7 @@
         {
             typedef typename T::first_type key_;
             typedef typename T::second_type data_;
- namespace ns = contingency_table::factor;
+ namespace ns = contingency_table;
             
             // See domain_error_logger for justification of fully qualified.
             this->impl<key_,data_>(
@@ -51,13 +50,12 @@
     };
 
 template<typename A,typename E>
-contingency_table::factor::check_against_domain<A,E>
+contingency_table::check_against_domain<A,E>
 make_check_against_domain(const A& acc,const E& error_logger){
- typedef contingency_table::factor::check_against_domain<A,E> checker_;
+ typedef contingency_table::check_against_domain<A,E> checker_;
     return checker_(acc,error_logger);
 }
 
-}// factor
 }// contingency_table
 }// detail
 }// statistics

Modified: sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/factor/domain_error_logger.hpp
==============================================================================
--- sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/factor/domain_error_logger.hpp (original)
+++ sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/factor/domain_error_logger.hpp 2011-07-05 07:21:10 EDT (Tue, 05 Jul 2011)
@@ -14,7 +14,6 @@
 namespace statistics{
 namespace detail{
 namespace contingency_table{
-namespace factor{
 
 class domain_error_logger{
    typedef std::string str_;
@@ -52,7 +51,6 @@
    
 };
 
-}// factor
 }// contingency_table
 }// detail
 }// statistics

Modified: sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/factor/filter.hpp
==============================================================================
--- sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/factor/filter.hpp (original)
+++ sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/factor/filter.hpp 2011-07-05 07:21:10 EDT (Tue, 05 Jul 2011)
@@ -15,7 +15,6 @@
 namespace statistics{
 namespace detail{
 namespace contingency_table{
-namespace factor{
 
     template<typename Keys>
     struct filter{
@@ -27,10 +26,9 @@
         struct apply : boost::mpl::bool_<false>{};
         
         template<typename Key>
- struct apply< factor::tag::levels<Key> > : contains<Key>{};
+ struct apply< contingency_table::tag::levels<Key> > : contains<Key>{};
     };
 
-}// factor
 }// contingency_table
 }// detail
 }// statistics

Modified: sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/factor/keyword.hpp
==============================================================================
--- sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/factor/keyword.hpp (original)
+++ sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/factor/keyword.hpp 2011-07-05 07:21:10 EDT (Tue, 05 Jul 2011)
@@ -20,17 +20,19 @@
 namespace statistics{
 namespace detail{
 namespace contingency_table{
-namespace factor{
 
+ // For now use map_of_levels instead.
+
     template<typename Key>
- struct kwd{
- typedef kwd<Key> tag_;
+ struct kwd_levels{
+ typedef kwd_levels<Key> tag_;
         static ::boost::parameter::keyword<tag_> & instance;
     };
 
     template<typename Key>
- ::boost::parameter::keyword< kwd<Key> > &
- kwd<Key>::instance = ::boost::parameter::keyword< kwd<Key> >::get();
+ ::boost::parameter::keyword< kwd_levels<Key> > &
+ kwd_levels<Key>::instance
+ = ::boost::parameter::keyword< kwd_levels<Key> >::get();
 
     template<typename Keys>
     struct par_spec{
@@ -41,7 +43,7 @@
             boost::mpl::push_back<
                 boost::mpl::_1,
                 boost::parameter::required<
- factor::kwd<boost::mpl::_2>
+ contingency_table::kwd_levels<boost::mpl::_2>
>
>
>::type vec_required;
@@ -52,7 +54,6 @@
         
     };
 
-}// factor
 }// contingency_table
 }// detail
 }// statistics

Modified: sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/factor/levels.hpp
==============================================================================
--- sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/factor/levels.hpp (original)
+++ sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/factor/levels.hpp 2011-07-05 07:21:10 EDT (Tue, 05 Jul 2011)
@@ -32,7 +32,6 @@
 namespace statistics{
 namespace detail{
 namespace contingency_table{
-namespace factor{
 
 BOOST_PARAMETER_NAME(map_of_levels);
 
@@ -50,9 +49,9 @@
     class levels : public boost::accumulators::accumulator_base
     {
         typedef boost::accumulators::dont_care dont_care_;
- typedef factor::levels_traits<Key,T> traits_;
+ typedef contingency_table::levels_traits<Key,T> traits_;
         typedef typename traits_::set_ set_;
- typedef factor::kwd<Key> kwd_;
+ typedef contingency_table::kwd_levels<Key> kwd_;
 
         public:
         typedef Key key_type;
@@ -101,7 +100,6 @@
     };
 
 }// impl
-
 namespace tag
 {
     template<typename Key>
@@ -109,37 +107,54 @@
       : boost::accumulators::depends_on<>
     {
     
- //typedef factor::tpl_keyword<Key> keyword_;
+ //typedef contingency_table::tpl_keyword<Key> keyword_;
     
         struct impl{
             template<typename T,typename W>
             struct apply{
- typedef factor::impl::levels<Key,T> type;
+ typedef contingency_table::impl::levels<Key,T> type;
             };
         };
 
     };
     
 }// tag
-
 namespace result_of{
+namespace extract{
 
     template<typename Key,typename AccSet>
- struct factor
+ struct levels
     : boost::accumulators::detail::extractor_result<
- AccSet, factor::tag::levels<Key> >{};
+ AccSet, contingency_table::tag::levels<Key>
+ >{};
 
+}// extract
 }// result_of
 
+namespace levels_aux{
+
+ template<typename Key,typename AccSet>
+ struct value_of{
+ typedef typename contingency_table::result_of::extract::levels<
+ Key,AccSet>::type ref_levels_;
+ typedef typename boost::remove_cv<
+ typename boost::remove_reference<
+ ref_levels_
+ >::type
+ >::type levels_;
+ typedef typename levels_::value_type type;
+ };
+
+}// levels_aux
 namespace extract
 {
 
           template<typename Key,typename AccSet>
- typename factor::result_of::template
- factor<Key,AccSet>::type
+ typename contingency_table::result_of::extract:: template
+ levels<Key,AccSet>::type
           levels(AccSet const& acc)
     {
- typedef factor::tag::levels<Key> the_tag;
+ typedef contingency_table::tag::levels<Key> the_tag;
         return boost::accumulators::extract_result<the_tag>(acc);
           }
 
@@ -147,7 +162,6 @@
 
 using extract::levels;
 
-}// factor
 }// contingency_table
 }// detail
 }// statistics

Modified: sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/factor/vec_levels.hpp
==============================================================================
--- sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/factor/vec_levels.hpp (original)
+++ sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/factor/vec_levels.hpp 2011-07-05 07:21:10 EDT (Tue, 05 Jul 2011)
@@ -17,7 +17,6 @@
 namespace statistics{
 namespace detail{
 namespace contingency_table{
-namespace factor{
    
    template<typename Keys>
     struct vec_levels : boost::mpl::fold<
@@ -25,12 +24,10 @@
         boost::mpl::vector0<>,
         boost::mpl::push_back<
             boost::mpl::_1,
- contingency_table::factor::tag::levels<boost::mpl::_2>
+ contingency_table::tag::levels<boost::mpl::_2>
>
>{};
    
-
-}// factor
 }// contingency_table
 }// detail
 }// statistics

Modified: sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/include/cells.hpp
==============================================================================
--- sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/include/cells.hpp (original)
+++ sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/include/cells.hpp 2011-07-05 07:21:10 EDT (Tue, 05 Jul 2011)
@@ -10,5 +10,10 @@
 
 #include <boost/statistics/detail/non_parametric/contingency_table/cells/cells.hpp>
 #include <boost/statistics/detail/non_parametric/contingency_table/cells/non_empty_cells_count.hpp>
+#include <boost/statistics/detail/non_parametric/contingency_table/cells/count_matching.hpp>
+#include <boost/statistics/detail/non_parametric/contingency_table/cells/marginal_cells.hpp>
+#include <boost/statistics/detail/non_parametric/contingency_table/cells/cells_count.hpp>
+#include <boost/statistics/detail/non_parametric/contingency_table/cells/traits.hpp>
+#include <boost/statistics/detail/non_parametric/contingency_table/cells/initializer.hpp>
 
 #endif

Modified: sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/include/pearson_chisq/common.hpp
==============================================================================
--- sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/include/pearson_chisq/common.hpp (original)
+++ sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/include/pearson_chisq/common.hpp 2011-07-05 07:21:10 EDT (Tue, 05 Jul 2011)
@@ -1,15 +1 @@
-///////////////////////////////////////////////////////////////////////////////
-// common.hpp //
-// //
-// Copyright 2010 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_DETAIL_NON_PARAMETRIC_CONTINGENCY_TABLE_INCLUDE_PEARSON_CHISQ_COMMON_HPP_ER_2010
-#define BOOST_STATISTICS_DETAIL_NON_PARAMETRIC_CONTINGENCY_TABLE_INCLUDE_PEARSON_CHISQ_COMMON_HPP_ER_2010
-
-#include <boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/common/df_formula.hpp>
-#include <boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/common/asy_distribution.hpp>
-#include <boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/common/chisq_summand_formula.hpp>
-
-#endif
+/* DEPRECATED */
\ No newline at end of file

Modified: sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/include/pearson_chisq/independence.hpp
==============================================================================
--- sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/include/pearson_chisq/independence.hpp (original)
+++ sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/include/pearson_chisq/independence.hpp 2011-07-05 07:21:10 EDT (Tue, 05 Jul 2011)
@@ -8,8 +8,7 @@
 #ifndef BOOST_STATISTICS_DETAIL_NON_PARAMETRIC_CONTINGENCY_TABLE_INCLUDE_PEARSON_CHISQ_INDEPENDENCE_HPP_ER_2010
 #define BOOST_STATISTICS_DETAIL_NON_PARAMETRIC_CONTINGENCY_TABLE_INCLUDE_PEARSON_CHISQ_INDEPENDENCE_HPP_ER_2010
 
-#include <boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/independence/df.hpp>
-#include <boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/independence/statistic.hpp>
-#include <boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/independence/tag.hpp>
+#include <boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/independence/feature.hpp>
+#include <boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/independence/null_hypothesis.hpp>
 
 #endif

Modified: sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/common/asy_distribution.hpp
==============================================================================
--- sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/common/asy_distribution.hpp (original)
+++ sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/common/asy_distribution.hpp 2011-07-05 07:21:10 EDT (Tue, 05 Jul 2011)
@@ -1,59 +1 @@
-///////////////////////////////////////////////////////////////////////////////
-// asy_distribution.hpp //
-// //
-// Copyright 2010 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_DETAIL_NON_PARAMETRIC_CONTINGENCY_TABLE_PEARSON_CHISQ_ASY_DISTRIBUTION_HPP_ER_2010
-#define BOOST_STATISTICS_DETAIL_NON_PARAMETRIC_CONTINGENCY_TABLE_PEARSON_CHISQ_ASY_DISTRIBUTION_HPP_ER_2010
-#include <boost/math/distributions/chi_squared.hpp>
-#include <boost/math/policies/policy.hpp>
-
-namespace boost {
-namespace statistics{
-namespace detail{
-namespace contingency_table{
-namespace pearson_chisq{
-namespace result_of{
-
- template<typename T1,typename Policy = boost::math::policies::policy<> >
- struct asy_distribution{
- typedef boost::math::chi_squared_distribution<T1,Policy> type;
- };
-
-}
-
- template<typename T1,typename AccSet,typename H0,typename Policy>
- typename pearson_chisq::result_of::asy_distribution<T1,Policy>::type
- asy_distribution(
- const AccSet& acc,
- const H0& hypothesis,
- const Policy& pol
- )
- {
- typename pearson_chisq::result_of::asy_distribution<
- T1,Policy>::type result_;
- return result_(
- pearson_chisq::df( hypothesis )
- );
- }
-
- template<typename T1,typename AccSet,typename H0>
- typename pearson_chisq::result_of::asy_distribution<T1>::type
- asy_distribution(const AccSet& acc,const H0& hypothesis){
- typedef boost::math::policies::policy<> pol_;
- return pearson_chisq::asy_distribution(
- acc,
- hypothesis,
- pol_()
- );
- }
-
-}// pearson_chisq
-}// contingency_table
-}// detail
-}// statistics
-}// boost
-
-#endif
+/* DEPRECATED */

Modified: sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/common/chisq_summand_formula.hpp
==============================================================================
--- sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/common/chisq_summand_formula.hpp (original)
+++ sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/common/chisq_summand_formula.hpp 2011-07-05 07:21:10 EDT (Tue, 05 Jul 2011)
@@ -1,35 +1 @@
-///////////////////////////////////////////////////////////////////////////////
-// chisq_summand.hpp //
-// //
-// Copyright 2010 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_DETAIL_NON_PARAMETRIC_CONTINGENCY_TABLE_PEARSON_CHISQ_CHISQ_SUMMAND_FORMULA_HPP_ER_2010
-#define BOOST_STATISTICS_DETAIL_NON_PARAMETRIC_CONTINGENCY_TABLE_PEARSON_CHISQ_CHISQ_SUMMAND_FORMULA_HPP_ER_2010
-#include <boost/numeric/conversion/converter.hpp>
-
-namespace boost {
-namespace statistics{
-namespace detail{
-namespace contingency_table{
-namespace pearson_chisq{
-
- template<typename T1,typename T2,typename T3>
- T1 chisq_summand_formula(const T2& expected_n, const T3& observed_n)
- {
- typedef boost::numeric::converter<T1,T2> conv2_;
- typedef boost::numeric::converter<T1,T3> conv3_;
- T1 summand = conv2_::convert( expected_n )
- - conv3_::convert( observed_n );
- summand *= summand;
- return summand / conv2_::convert( expected_n );
- }
-
-}// pearson_chisq
-}// contingency_table
-}// detail
-}// statistics
-}// boost
-
-#endif
+/* DEPRECATED */

Modified: sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/common/df_formula.hpp
==============================================================================
--- sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/common/df_formula.hpp (original)
+++ sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/common/df_formula.hpp 2011-07-05 07:21:10 EDT (Tue, 05 Jul 2011)
@@ -1,40 +1 @@
-///////////////////////////////////////////////////////////////////////////////
-// df_formula.hpp //
-// //
-// Copyright 2010 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_DETAIL_NON_PARAMETRIC_CONTINGENCY_TABLE_PEARSON_CHISQ_DF_FORMULA_HPP_ER_2010
-#define BOOST_STATISTICS_DETAIL_NON_PARAMETRIC_CONTINGENCY_TABLE_PEARSON_CHISQ_DF_FORMULA_HPP_ER_2010
-
-namespace boost {
-namespace statistics{
-namespace detail{
-namespace contingency_table{
-namespace pearson_chisq{
-
-// http://wapedia.mobi/en/Pearson%27s_chi-square_test
-
-// General formula
-// df = ( N1 - 1 ) - N2
-// N1 = # cells in table
-// N2 = # of estimated probabilities under H0 a.k.a lost df under H0
-//
-// For example, test of independence in dimension = 2
-// Known result : df = (r − 1)(c − 1) = rc -r -c + 1
-// By formula : df = ( rc - 1 ) - ( (r-1) + (c-1) ) = rc -r -c + 1
-
- template<typename Int>
- Int df_formula(Int number_of_cells,Int lost_df)
- {
- return (number_of_cells - 1) - lost_df;
- }
-
-}// pearson_chisq
-}// contingency_table
-}// detail
-}// statistics
-}// boost
-
-#endif
+/* DEPRECATED */

Modified: sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/independence/depends_on.hpp
==============================================================================
--- sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/independence/depends_on.hpp (original)
+++ sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/independence/depends_on.hpp 2011-07-05 07:21:10 EDT (Tue, 05 Jul 2011)
@@ -16,14 +16,13 @@
 namespace statistics{
 namespace detail{
 namespace contingency_table{
-namespace pearson_chisq{
-namespace independence_aux{
+namespace independence_between_aux{
 
     template<typename Keys>
     struct depends_on{
- typedef typename cells::marginal_cells<Keys>::type marginal_;
- typedef contingency_table::cells::tag::cells<Keys> joint_;
-// typedef boost::accumulators::tag::count count_;
+ typedef typename
+ contingency_table::marginal_cells<Keys>::type marginal_;
+ typedef contingency_table::tag::cells<Keys> joint_;
         typedef boost::accumulators::tag::weighted_count weighted_count_;
         typedef typename boost::mpl::push_back<
             typename boost::mpl::push_back<
@@ -38,8 +37,7 @@
>::type type;
     };
 
-}// independence_aux
-}// pearson_chisq
+}// independence_between_aux
 }// contingency_table
 }// detail
 }// statistics

Modified: sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/independence/df.hpp
==============================================================================
--- sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/independence/df.hpp (original)
+++ sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/independence/df.hpp 2011-07-05 07:21:10 EDT (Tue, 05 Jul 2011)
@@ -1,36 +1,2 @@
-///////////////////////////////////////////////////////////////////////////////
-// df.hpp //
-// //
-// Copyright 2010 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_DETAIL_NON_PARAMETRIC_CONTINGENCY_TABLE_PEARSON_CHISQ_INDEPENDENCE_DF_HPP_ER_2010
-#define BOOST_STATISTICS_DETAIL_NON_PARAMETRIC_CONTINGENCY_TABLE_PEARSON_CHISQ_INDEPENDENCE_DF_HPP_ER_2010
-#include <boost/statistics/detail/non_parametric/contingency_table/cells/cells_count.hpp>
-#include <boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/common/df_formula.hpp>
-#include <boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/independence/lost_df.hpp>
-
-namespace boost {
-namespace statistics{
-namespace detail{
-namespace contingency_table{
-namespace pearson_chisq{
-
- template<typename Keys,typename AccSet>
- long df(AccSet const& acc,tag::independence<Keys> hypothesis){
- namespace ns = contingency_table::cells;
- return pearson_chisq::df_formula<long>(
- ns::cells_count<Keys>( acc ),
- lost_df( acc, hypothesis )
- );
- }
-
-}// pearson_chisq
-}// contingency_table
-}// detail
-}// statistics
-}// boost
-
-#endif
+/* DEPRECATED */
 

Modified: sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/independence/impl.hpp
==============================================================================
--- sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/independence/impl.hpp (original)
+++ sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/independence/impl.hpp 2011-07-05 07:21:10 EDT (Tue, 05 Jul 2011)
@@ -1,44 +1 @@
-///////////////////////////////////////////////////////////////////////////////
-// impl.hpp //
-// //
-// Copyright 2010 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_DETAIL_NON_PARAMETRIC_CONTINGENCY_TABLE_PEARSON_CHISQ_INDEPENDENCE_IMPL_HPP_ER_2010
-#define BOOST_STATISTICS_DETAIL_NON_PARAMETRIC_CONTINGENCY_TABLE_PEARSON_CHISQ_INDEPENDENCE_IMPL_HPP_ER_2010
-#include <boost/accumulators/framework/accumulator_base.hpp>
-
-namespace boost {
-namespace statistics{
-namespace detail{
-namespace contingency_table{
-namespace pearson_chisq{
-namespace impl{
-
- template<typename Keys>
- class independence : public boost::accumulators::accumulator_base
- {
- typedef boost::accumulators::dont_care dont_care_;
-
- public:
-
- typedef void result_type;
-
- independence(dont_care_){}
-
- void operator()(dont_care_)const{}
-
- result_type result(dont_care_)const{}
-
- };
-
-}// impl
-}// pearson_chisq
-}// contingency_table
-}// detail
-}// statistics
-}// boost
-
-#endif
-
+/* DEPRECATED */
\ No newline at end of file

Modified: sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/independence/lost_df.hpp
==============================================================================
--- sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/independence/lost_df.hpp (original)
+++ sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/independence/lost_df.hpp 2011-07-05 07:21:10 EDT (Tue, 05 Jul 2011)
@@ -1,72 +1 @@
-///////////////////////////////////////////////////////////////////////////////
-// lost_df.hpp //
-// //
-// Copyright 2010 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_DETAIL_NON_PARAMETRIC_CONTINGENCY_TABLE_PEARSON_CHISQ_INDEPENDENCE_LOST_DF_HPP_ER_2010
-#define BOOST_STATISTICS_DETAIL_NON_PARAMETRIC_CONTINGENCY_TABLE_PEARSON_CHISQ_INDEPENDENCE_LOST_DF_HPP_ER_2010
-#include <boost/range.hpp>
-#include <boost/accumulators/framework/depends_on.hpp> //contains_feature_of
-#include <boost/accumulators/framework/accumulator_set.hpp> //visit_if
-#include <boost/mpl/detail/wrapper.hpp>
-#include <boost/statistics/detail/non_parametric/contingency_table/factor/vec_levels.hpp>
-#include <boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/independence/tag.hpp>
-
-namespace boost {
-namespace statistics{
-namespace detail{
-namespace contingency_table{
-namespace pearson_chisq{
-
-namespace independence_aux{
-
- template<typename A>
- struct lost_df_accumulator{
-
- lost_df_accumulator(const A& acc,std::size_t& df)
- :acc_(acc),df_(df){}
-
- template<typename Key>
- void operator()(const statistics::detail::mpl_wrapper<Key>& wrapper)const{
- namespace ns = contingency_table::factor::extract;
- this->df_ += (ns::levels<Key>( this->acc_ ).size() - 1);
- }
-
- private:
- const A& acc_;
- mutable std::size_t& df_;
- };
-
-
- template<typename A>
- independence_aux::lost_df_accumulator<A>
- make_lost_df_accumulator(const A& acc,std::size_t& df){
- return independence_aux::lost_df_accumulator<A>(acc,df);
- }
-
-}// independence_aux
-
- template<typename Keys,typename AccSet>
- std::size_t lost_df(
- AccSet const& acc,
- pearson_chisq::tag::independence<Keys> hypothesis
- )
- {
- namespace ns = boost::statistics::detail;
- typedef ns::mpl_wrapper<boost::mpl::_> op_;
- std::size_t result = 0;
- boost::mpl::for_each<Keys,op_>(
- independence_aux::make_lost_df_accumulator(acc, result)
- );
- return result;
- }
-
-}// pearson_chisq
-}// contingency_table
-}// detail
-}// statistics
-}// boost
-
-#endif
+/* DEPRECATED */

Modified: sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/independence/statistic.hpp
==============================================================================
--- sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/independence/statistic.hpp (original)
+++ sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/independence/statistic.hpp 2011-07-05 07:21:10 EDT (Tue, 05 Jul 2011)
@@ -1,126 +1 @@
-///////////////////////////////////////////////////////////////////////////////
-// statistic.hpp //
-// //
-// Copyright 2010 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_DETAIL_NON_PARAMETRIC_CONTINGENCY_TABLE_PEARSON_CHISQ_INDEPENDENCE_STATISTIC_HPP_ER_2010
-#define BOOST_STATISTICS_DETAIL_NON_PARAMETRIC_CONTINGENCY_TABLE_PEARSON_CHISQ_INDEPENDENCE_STATISTIC_HPP_ER_2010
-#include <cmath>
-#include <boost/mpl/size.hpp>
-#include <boost/mpl/fold.hpp>
-#include <boost/mpl/for_each.hpp>
-#include <boost/mpl/push_back.hpp>
-#include <boost/mpl/placeholders.hpp>
-#include <boost/mpl/vector/vector10.hpp>
-#include <boost/lambda/lambda.hpp>
-#include <boost/lambda/bind.hpp>
-#include <boost/numeric/conversion/converter.hpp>
-#include <boost/type_traits/add_const.hpp>
-#include <boost/type_traits/remove_reference.hpp>
-#include <boost/foreach.hpp>
-#include <boost/range.hpp>
-#include <boost/accumulators/statistics/detail/weighted_count.hpp>
-#include <boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/common/chisq_summand_formula.hpp>
-#include <boost/statistics/detail/non_parametric/contingency_table/cells/cells.hpp>
-#include <boost/statistics/detail/non_parametric/contingency_table/cells/count_matching.hpp>
-
-// Under independence, in dimension = 2
-// p_{j1,j2} = p_{j1} * p{j2}
-
-// Warning : this is incomplete / Wrong.
-
-namespace boost {
-namespace statistics{
-namespace detail{
-namespace contingency_table{
-namespace pearson_chisq{
-namespace independence_aux{
-
- template<typename T1,typename Keys,typename AccSet>
- struct chisq_summand
- {
-
- typedef std::size_t size_;
- typedef typename boost::mpl::size<Keys>::type keys_count_;
-
- template<typename N>
- chisq_summand(const AccSet& a, const N& total_count)
- : acc( a ) , denom(
- pow( total_count, keys_count_::value - 1)
- ){}
-
- template<typename C>
- T1 operator()(const C& cell)const
- {
- namespace ns = boost::statistics::detail;
- typedef ns::mpl_wrapper<
- boost::mpl::vector1< boost::mpl::_ >
- > op_;
- typedef boost::numeric::converter<T1,size_> conv_;
- size_ n = 1;
- boost::mpl::for_each<Keys,op_>(
- cells::make_count_matching_aux(acc, cell.first, prod_fun( n ) )
- );
- return chisq_summand_formula<T1>(
- conv_::convert( n ) / conv_::convert( denom ),
- cell.second
- );
- }
-
- struct prod_fun{
-
- prod_fun(size_& n) : n_( n ){}
-
- template<typename T>
- void operator()(const T& k)const{
- this->n_ *= k;
- }
-
- mutable size_& n_;
- };
-
- const AccSet& acc;
- size_ denom;
-
- };
-
-}// independence_aux
-
- template<typename T1,typename Keys,typename AccSet>
- T1 statistic(
- const AccSet& acc,
- pearson_chisq::tag::independence<Keys> hypothesis
- )
- {
- namespace ns = pearson_chisq::independence_aux;
- typedef typename contingency_table::cells::result_of::extract::cells<
- Keys,AccSet>::type ref_cells_;
- typedef typename boost::remove_reference<ref_cells_>::type cells_;
- typedef typename boost::range_reference<cells_>::type ref_cell_;
- typedef ns::chisq_summand<T1,Keys,AccSet> summand_;
- typedef std::size_t size_;
-
- ref_cells_ ref_cells = cells::extract::cells<Keys>( acc );
- size_ n_obs = boost::accumulators::extract::weighted_count( acc );
-
- summand_ summand(acc, n_obs);
- typedef boost::numeric::converter<T1,size_> conv_;
-
- T1 result = conv_::convert( 0 );
- BOOST_FOREACH(ref_cell_ ref_cell, ref_cells )
- {
- result += summand( ref_cell );
- }
-
- return result;
- }
-
-}// pearson_chisq
-}// contingency_table
-}// detail
-}// statistics
-}// boost
-
-#endif
+/* DEPRECATED */
\ No newline at end of file

Modified: sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/independence/tag.hpp
==============================================================================
--- sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/independence/tag.hpp (original)
+++ sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/independence/tag.hpp 2011-07-05 07:21:10 EDT (Tue, 05 Jul 2011)
@@ -1,39 +1 @@
-///////////////////////////////////////////////////////////////////////////////
-// tag.hpp //
-// //
-// Copyright 2010 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_DETAIL_NON_PARAMETRIC_CONTINGENCY_TABLE_PEARSON_CHISQ_INDEPENDENCE_TAG_HPP_ER_2010
-#define BOOST_STATISTICS_DETAIL_NON_PARAMETRIC_CONTINGENCY_TABLE_PEARSON_CHISQ_INDEPENDENCE_TAG_HPP_ER_2010
-
-#include <boost/mpl/always.hpp>
-#include <boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/independence/impl.hpp>
-#include <boost/statistics/detail/non_parametric/contingency_table/pearson_chisq/independence/depends_on.hpp>
-
-namespace boost {
-namespace statistics{
-namespace detail{
-namespace contingency_table{
-namespace pearson_chisq{
-namespace tag
-{
- template<typename Keys>
- struct independence
- : independence_aux::template depends_on<Keys>::type
- {
- typedef boost::mpl::always<
- pearson_chisq::impl::independence<Keys>
- > impl;
- };
-
-}// tag
-}// pearson_chisq
-}// contingency_table
-}// detail
-}// statistics
-}// boost
-
-#endif
-
+/* DEPRECATED */

Modified: sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/kolmogorov_smirnov/check_convergence.hpp
==============================================================================
--- sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/kolmogorov_smirnov/check_convergence.hpp (original)
+++ sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/kolmogorov_smirnov/check_convergence.hpp 2011-07-05 07:21:10 EDT (Tue, 05 Jul 2011)
@@ -12,7 +12,7 @@
 #include <boost/mpl/copy.hpp>
 #include <boost/mpl/back_inserter.hpp>
 #include <boost/mpl/placeholders.hpp>
-
+#include <boost/numeric/conversion/bounds.hpp>
 #include <boost/accumulators/framework/extractor.hpp>
 #include <boost/accumulators/framework/accumulator_base.hpp>
 #include <boost/accumulators/framework/parameters/sample.hpp>
@@ -27,7 +27,7 @@
 namespace boost{
 namespace statistics{
 namespace detail{
-namespace kolmogorov_smirnov{
+namespace empirical_distribution{
 
     // Usage:
     // check_convergence<> check;
@@ -39,15 +39,16 @@
             typename T1 = double,
             typename MoreFeatures = boost::accumulators::stats<>
>
- struct check_convergence{
+ struct check_convergence
+ {
     
             typedef T1 value_type;
         typedef kolmogorov_smirnov::tag::kolmogorov_smirnov tag_;
- typedef boost::accumulators::stats<tag_> state_;
+ typedef boost::accumulators::stats<tag_> stats_;
             typedef boost::mpl::push_back<boost::mpl::_,boost::mpl::_> op_;
     
                typedef typename boost::mpl::copy<
- MoreFeatures,boost::mpl::back_inserter< state_ >
+ MoreFeatures,boost::mpl::back_inserter< stats_ >
>::type mpl_features;
     
             public:
@@ -66,12 +67,12 @@
> acc_;
         };
     
- template<typename N1,typename N2,typename N3,typename D,typename G>
+ template<typename D,typename G>
         typename traits<D,G>::acc_
         operator()(
- N1 n_loops,
- N2 n, // n *= n_factor at each loop
- N3 n_factor,
+ long n_loops,
+ long n, // n *= n_factor at each loop
+ long n_factor,
             const D& dist,
             G& gen,
             std::ostream& os
@@ -90,9 +91,6 @@
 
         template<
             typename Args,
- typename N1,
- typename N2,
- typename N3,
             typename D,
             typename G,
             typename F,
@@ -101,9 +99,9 @@
         typename traits<D,G>::acc_
         operator()(
             const Args& args,
- N1 n_loops,
- N2 n, // n *= n_factor at each loop
- N3 n_factor,
+ long n_loops,
+ long n, // n *= n_factor at each loop
+ long n_factor,
             const D& dist,
             G& gen,
             const F& fun,
@@ -117,8 +115,8 @@
             
             acc_ acc(args);
         
- for(int i1 = 0; i1<n_loops; i1++){
- for(int i2 = 0; i2< n; i2++){
+ for(long i1 = 0; i1<n_loops; i1++){
+ for(long i2 = 0; i2< n; i2++){
                     sample_type x = gen();
                     acc(x);
                 } // grows sample by n
@@ -132,27 +130,37 @@
 
         template<typename D>
             struct default_fun{
- default_fun(){}
+
+ typedef boost::numeric::bounds<value_type> bounds_;
+
+ default_fun() : ks0( bounds_::highest() ){}
                 
             template<typename AccSet>
             void operator()(const AccSet& acc,const D& d,std::ostream& os)const{
                 namespace ns = kolmogorov_smirnov;
- value_type ks = ns::statistic<value_type>( acc, d );
+ value_type ks1 = ns::statistic<value_type>( acc, d );
+ bool ok = ks1 - ks0 < bounds_::smallest();
                 os
                     << '('
                     << boost::accumulators::extract::count(acc)
                     << ','
- << ks
+ << ks1
+ << ','
+ << ok
                     << ')'
                     << std::endl;
             }
+
+ private:
+ mutable value_type ks0;
+
             };
     
     };
     
-}// kolmogorov_smirnov
+}// empirical_distribution
 }// detail
 }// statistics
 }// boost
 
-#endif
\ No newline at end of file
+#endif

Modified: sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/kolmogorov_smirnov/statistic.hpp
==============================================================================
--- sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/kolmogorov_smirnov/statistic.hpp (original)
+++ sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/kolmogorov_smirnov/statistic.hpp 2011-07-05 07:21:10 EDT (Tue, 05 Jul 2011)
@@ -30,8 +30,7 @@
 namespace boost {
 namespace statistics{
 namespace detail{
-namespace kolmogorov_smirnov{
-
+namespace empirical_distribution{
 namespace impl{
 
     // Warning : See empirical_distribution::impl::count
@@ -58,7 +57,6 @@
         };
     
 }
-
 namespace tag
 {
     struct kolmogorov_smirnov
@@ -78,7 +76,7 @@
 namespace result_of{
 
     template<typename T1,typename AccSet,typename D>
- struct statistic
+ struct kolmogorov_smirnov_statistic
     {
         typedef T1 type;
     };
@@ -88,8 +86,8 @@
     // Usage : statistic<T1>(acc,dist)
     template<typename T1,typename AccSet,typename D>
     typename kolmogorov_smirnov
- ::result_of::template statistic<T1,AccSet,D>::type
- statistic(AccSet const& acc,const D& dist)
+ ::result_of::template kolmogorov_smirnov_statistic<T1,AccSet,D>::type
+ kolmogorov_smirnov_statistic(AccSet const& acc,const D& dist)
     {
             namespace ed = boost::statistics::detail::empirical_distribution;
             namespace ks = boost::statistics::detail::kolmogorov_smirnov;
@@ -126,6 +124,8 @@
             return m1;
     }
 
+
+}// kolgorov_statistic
 }// empirical_distribution
 }// detail
 }// statistics


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