1 #ifndef __STAN__PROB__DISTRIBUTIONS__WEIBULL_HPP__
2 #define __STAN__PROB__DISTRIBUTIONS__WEIBULL_HPP__
17 template <
bool propto,
18 typename T_y,
typename T_shape,
typename T_scale,
20 typename return_type<T_y,T_shape,T_scale>::type
21 weibull_log(
const T_y& y,
const T_shape& alpha,
const T_scale& sigma,
23 static const char*
function =
"stan::prob::weibull_log(%1%)";
39 if(!
check_finite(
function, y,
"Random variable", &logp, Policy()))
55 "Random variable",
"Shape parameter",
"Scale parameter",
66 size_t N =
max_size(y, alpha, sigma);
68 for (
size_t n = 0; n < N; n++) {
69 const double y_dbl =
value_of(y_vec[n]);
76 for (
size_t n = 0; n < N; n++) {
78 logp +=
log(alpha_vec[n]);
84 logp -=
pow(y_vec[n] / sigma_vec[n], alpha_vec[n]);
90 template <
bool propto,
91 typename T_y,
typename T_shape,
typename T_scale>
94 weibull_log(
const T_y& y,
const T_shape& alpha,
const T_scale& sigma) {
99 template <
typename T_y,
typename T_shape,
typename T_scale,
103 weibull_log(
const T_y& y,
const T_shape& alpha,
const T_scale& sigma,
105 return weibull_log<false>(y,alpha,sigma,Policy());
109 template <
typename T_y,
typename T_shape,
typename T_scale>
112 weibull_log(
const T_y& y,
const T_shape& alpha,
const T_scale& sigma) {
119 template <
typename T_y,
typename T_shape,
typename T_scale,
121 typename boost::math::tools::promote_args<T_y,T_shape,T_scale>::type
122 weibull_cdf(
const T_y& y,
const T_shape& alpha,
const T_scale& sigma,
125 static const char*
function =
"stan::prob::weibull_cdf(%1%)";
129 using boost::math::tools::promote_args;
131 typename promote_args<T_y,T_shape,T_scale>::type lp;
147 return 1.0 -
exp(-
pow(y / sigma, alpha));
150 template <
typename T_y,
typename T_shape,
typename T_scale>
152 typename boost::math::tools::promote_args<T_y,T_shape,T_scale>::type
153 weibull_cdf(
const T_y& y,
const T_shape& alpha,
const T_scale& sigma) {