Statistical Accumulator
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...
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
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...
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
> > 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
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...
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
> > 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
? 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... Mean and other statistical function works, but only the covariance doesn't Thanks Phil
On 7/7/2010 11:00 AM, Kraus Philipp wrote:
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...
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
> > 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
? 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...
--------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FYI, that's not where Boost's documentation lives. For the most recent docs, see: http://www.boost.org/doc/libs/1_43_0/doc/html/accumulators/user_s_guide.html...
Mean and other statistical function works, but only the covariance doesn't
I think you need to add:
#include
Am 07.07.2010 um 17:52 schrieb Eric Niebler:
On 7/7/2010 11:00 AM, Kraus Philipp wrote:
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...
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
> > 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
? 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...
--------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FYI, that's not where Boost's documentation lives. For the most recent docs, see:
http://www.boost.org/doc/libs/1_43_0/doc/html/accumulators/user_s_guide.html...
Mean and other statistical function works, but only the covariance doesn't
I think you need to add:
#include
The following program compiles for me:
#include
#include #include #include namespace acc = boost::accumulators;
int main() { acc::accumulator_set
> > acc; acc(1., acc::covariate1 = 2.); acc(1., acc::covariate1 = 4.); acc(2., acc::covariate1 = 3.); acc(6., acc::covariate1 = 1.); BOOST_ASSERT(acc::covariance(acc) == -1.75); } I'll add this information to the docs.
Thanks works fine. I don't include the variates/covariate.hpp
participants (2)
-
Eric Niebler
-
Kraus Philipp