Skip to content

Commit

Permalink
updating tests after removing _log() probability functions
Browse files Browse the repository at this point in the history
  • Loading branch information
syclik committed Jan 4, 2024
1 parent c1bf4c4 commit ddd12a3
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 83 deletions.
67 changes: 0 additions & 67 deletions stan/math/prim/prob.hpp

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion stan/math/prim/prob/lkj_corr_cholesky_lpdf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <stan/math/prim/fun/make_nu.hpp>
#include <stan/math/prim/fun/multiply.hpp>
#include <stan/math/prim/fun/to_ref.hpp>
#include <stan/math/prim/prob/lkj_corr_log.hpp>

namespace stan {
namespace math {
Expand Down
8 changes: 4 additions & 4 deletions stan/math/prim/prob/logistic_cdf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <stan/math/prim/fun/size_zero.hpp>
#include <stan/math/prim/fun/value_of.hpp>
#include <stan/math/prim/fun/inv_logit.hpp>
#include <stan/math/prim/prob/logistic_log.hpp>
#include <stan/math/prim/prob/logistic_lpdf.hpp>
#include <stan/math/prim/functor/partials_propagator.hpp>
#include <cmath>

Expand Down Expand Up @@ -78,16 +78,16 @@ return_type_t<T_y, T_loc, T_scale> logistic_cdf(const T_y& y, const T_loc& mu,

if (!is_constant_all<T_y>::value) {
partials<0>(ops_partials)[n]
+= exp(logistic_log(y_dbl, mu_dbl, sigma_dbl)) / Pn;
+= exp(logistic_lpdf(y_dbl, mu_dbl, sigma_dbl)) / Pn;
}
if (!is_constant_all<T_loc>::value) {
partials<1>(ops_partials)[n]
+= -exp(logistic_log(y_dbl, mu_dbl, sigma_dbl)) / Pn;
+= -exp(logistic_lpdf(y_dbl, mu_dbl, sigma_dbl)) / Pn;
}
if (!is_constant_all<T_scale>::value) {
partials<2>(ops_partials)[n]
+= -(y_dbl - mu_dbl) * sigma_inv_vec
* exp(logistic_log(y_dbl, mu_dbl, sigma_dbl)) / Pn;
* exp(logistic_lpdf(y_dbl, mu_dbl, sigma_dbl)) / Pn;
}
}

Expand Down
8 changes: 4 additions & 4 deletions stan/math/prim/prob/logistic_lccdf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <stan/math/prim/fun/size.hpp>
#include <stan/math/prim/fun/size_zero.hpp>
#include <stan/math/prim/fun/value_of.hpp>
#include <stan/math/prim/prob/logistic_log.hpp>
#include <stan/math/prim/prob/logistic_lpdf.hpp>
#include <stan/math/prim/functor/partials_propagator.hpp>
#include <cmath>

Expand Down Expand Up @@ -79,16 +79,16 @@ return_type_t<T_y, T_loc, T_scale> logistic_lccdf(const T_y& y, const T_loc& mu,

if (!is_constant_all<T_y>::value) {
partials<0>(ops_partials)[n]
-= exp(logistic_log(y_dbl, mu_dbl, sigma_dbl)) / Pn;
-= exp(logistic_lpdf(y_dbl, mu_dbl, sigma_dbl)) / Pn;
}
if (!is_constant_all<T_loc>::value) {
partials<1>(ops_partials)[n]
-= -exp(logistic_log(y_dbl, mu_dbl, sigma_dbl)) / Pn;
-= -exp(logistic_lpdf(y_dbl, mu_dbl, sigma_dbl)) / Pn;
}
if (!is_constant_all<T_scale>::value) {
partials<2>(ops_partials)[n]
-= -(y_dbl - mu_dbl) * sigma_inv_vec
* exp(logistic_log(y_dbl, mu_dbl, sigma_dbl)) / Pn;
* exp(logistic_lpdf(y_dbl, mu_dbl, sigma_dbl)) / Pn;
}
}
return ops_partials.build(P);
Expand Down
8 changes: 4 additions & 4 deletions stan/math/prim/prob/logistic_lcdf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <stan/math/prim/fun/size.hpp>
#include <stan/math/prim/fun/size_zero.hpp>
#include <stan/math/prim/fun/value_of.hpp>
#include <stan/math/prim/prob/logistic_log.hpp>
#include <stan/math/prim/prob/logistic_lpdf.hpp>
#include <stan/math/prim/functor/partials_propagator.hpp>
#include <cmath>

Expand Down Expand Up @@ -78,16 +78,16 @@ return_type_t<T_y, T_loc, T_scale> logistic_lcdf(const T_y& y, const T_loc& mu,

if (!is_constant_all<T_y>::value) {
partials<0>(ops_partials)[n]
+= exp(logistic_log(y_dbl, mu_dbl, sigma_dbl)) / Pn;
+= exp(logistic_lpdf(y_dbl, mu_dbl, sigma_dbl)) / Pn;
}
if (!is_constant_all<T_loc>::value) {
partials<1>(ops_partials)[n]
+= -exp(logistic_log(y_dbl, mu_dbl, sigma_dbl)) / Pn;
+= -exp(logistic_lpdf(y_dbl, mu_dbl, sigma_dbl)) / Pn;
}
if (!is_constant_all<T_scale>::value) {
partials<2>(ops_partials)[n]
+= -(y_dbl - mu_dbl) * sigma_inv_vec
* exp(logistic_log(y_dbl, mu_dbl, sigma_dbl)) / Pn;
* exp(logistic_lpdf(y_dbl, mu_dbl, sigma_dbl)) / Pn;
}
}
return ops_partials.build(P);
Expand Down
1 change: 0 additions & 1 deletion stan/math/prim/prob/multi_student_t_lpdf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include <stan/math/prim/fun/size_mvt.hpp>
#include <stan/math/prim/fun/to_ref.hpp>
#include <stan/math/prim/fun/vector_seq_view.hpp>
#include <stan/math/prim/prob/multi_normal_log.hpp>
#include <cmath>
#include <cstdlib>

Expand Down
2 changes: 1 addition & 1 deletion test/prob/beta/beta_test.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Arguments: Doubles, Doubles, Doubles
#include <stan/math/prim/prob/beta_log.hpp>
#include <stan/math/prim/prob/beta_lpdf.hpp>
#include <stan/math/prim/fun/lgamma.hpp>
#include <stan/math/prim/fun/log1m.hpp>

Expand Down
2 changes: 1 addition & 1 deletion test/unit/math_include_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ TEST_F(Math, paper_example_3) {
double y = 1.3;
stan::math::var mu = 0.5, sigma = 1.2;

stan::math::var lp = normal_log(y, mu, sigma);
stan::math::var lp = normal_lpdf(y, mu, sigma);
EXPECT_FLOAT_EQ(-1.323482, lp.val());
}

Expand Down

0 comments on commit ddd12a3

Please sign in to comment.