问题
I am fairly new to c++ and boost.
I want to create a set of numbers that derived from a skewed distribution using Boost's skewed_normal_distribution
class.
I'm not sure how to even start. I want to define a distribution with mean 0.05, variance 0.95, but a skew of 0.5. The following code doesn't work and I realise I need to set up a variate_generator
as well.
Can anyone provide some pointers? I am not finding the boost documentation page on skew_normal_distribution
very intuitive but that might be because of my inexperience.
Note the main problem I am getting is the message:
‘skew_normal_distribution
’ is not a member of ‘boost
’
Many thanks
#include <boost/random.hpp>
#include <boost/random/normal_distribution.hpp>
#include <boost/math/distributions/skew_normal.hpp>
int main () {
boost::skew_normal_distribution<> normal(0.05, 0.95, 0.5);
return 0;
}
回答1:
Use boost::math::skew_normal_distribution
instead of boost::skew_normal_distribution
for the message
skew_normal_distribution
is not a member ofboost
来源:https://stackoverflow.com/questions/38185604/using-boosts-skewed-normal-distribution