Boost logo

Boost Users :

Subject: Re: [Boost-users] Statistical Accumulator
From: Kraus Philipp (philipp.kraus_at_[hidden])
Date: 2010-07-07 11:00:54


Am 07.07.2010 um 14:00 schrieb Eric Niebler:

> On 7/6/2010 4:31 PM, Kraus Philipp wrote:
>> Hi,
>>
>> I try to calulate the covariance from some data.
>>
>> http://www.boost.org/doc/libs/1_43_0/doc/html/accumulators/user_s_guide.html#accumulators.user_s_guide.the_statistical_accumulators_library.covariance
>>
>> I don't understand the call "acc call". I would like to rebuild the
>> cov
>> command form Matlab for matrix data
>> (http://www.mathworks.com/access/helpdesk/help/techdoc/ref/cov.html).
>> If this is correct, when I give as the first argument of command data
>> from the first line and second as the data of the first column to
>> the
>> first value to calculate the new matrix?
>>
>> I try try compile the excample, but I get a compiler error on the
>> "acc::tag::covariate1":
>>
>> acc::accumulator_set<double,
>> acc::stats<acc::tag::covariance<double,
>> acc::tag::covariate1> > > xx;
>>
>> xx(1., acc::tag::covariate1 = 2.);
>> xx(1., acc::tag::covariate1 = 4.);
>> xx(2., acc::tag::covariate1 = 3.);
>> xx(6., acc::tag::covariate1 = 1.);
>>
>> std::cout << acc::covariance(xx) << std::endl;
>>
>> The error text: "expected primary-expression befor = token". Sorry,
>> it's
>> a little bit late, so I don't see my mistake
>
> It's impossible to say from just the little code fragment you've
> included here. Have you #include
> <boost/accumulators/statistics/covariance.hpp>?
>
> Please include a complete example that demonstrates the problem next
> time.

Yes, I have had take the example form the Boost page: http://boost-sandbox.sourceforge.net/libs/accumulators/doc/html/accumulators/user_s_guide/the_statistical_accumulators_library.html#accumulators.user_s_guide.the_statistical_accumulators_library.covariance

Mean and other statistical function works, but only the covariance
doesn't

Thanks

Phil


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net