
Boost Users : 
Subject: Re: [Boostusers] how to calculate the Sample standard deviation using accumulators
From: Victor Yankee (victor.whiskey.yankee_at_[hidden])
Date: 20120118 12:36:18
Hello Marshall,
>On Jan 17, 2012, at 3:38 PM, Victor Yankee wrote:
>
>> How can I calculate the Sample Standard Deviation over a std::vector of
doubles using accumulators?
>>
>>Or is there a faster way in boost math or some such?
>
>
>Google is your friend (second hit for "boost accumulator standard
deviation"):
>
http://stackoverflow.com/questions/7616511/calculatemeanandstandarddeviationfromavectorofsamplesincusingboos
>and
http://stackoverflow.com/questions/4316716/isitpossibletouseboostaccumulatorswithvectors
>
>
> accumulator_set<double, stats<tag::variance> > acc;
> for_each(a_vec.begin(), a_vec.end(), bind<void>(ref(acc), _1));
>
> cout << mean(acc) << endl;
> cout << sqrt(variance(acc)) << endl;
But this is the POPULATION standard deviation (variance divided by N) I
think.
What I was asking for was how to calculated the SAMPLE standard deviation
(variance devided by N1).
Thanks,
Vic
Boostusers 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