diff options
author | tomsmeding <tom.smeding@gmail.com> | 2017-05-11 21:58:43 +0200 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2017-05-11 21:58:43 +0200 |
commit | 4b365556736a5316767fb5adac51b44bde0a077f (patch) | |
tree | 300bb42597b34a1d2f2af681ee0155bada39aaae | |
parent | 01aed029760fa81caf2f35f7093a22ae729b96b1 (diff) |
Add standard error of the mean
-rw-r--r-- | stddev.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -40,8 +40,10 @@ int main(int,char **argv){ total+=(v-s_mean)*(v-s_mean); } const double s_stddev=data.size()==1?nan(""):sqrt(total/(data.size()-1)); + const double s_stderr=s_stddev/sqrt(data.size()); - cout<<"Mean: "<<s_mean<<endl - <<"Stddev: "<<s_stddev<<endl + cout<<"Mean: "<<s_mean<<'\n' + <<"Stddev: "<<s_stddev<<'\n' + <<"Stderr: "<<s_stderr<<'\n' <<"Median: "<<s_median<<endl; } |