test/src_test/include/test_bicop_parametric.hpp
// Test if the C++ implementation of select method using the mle is correct
Test if the C++ implementation of select method using the mle is correct
Test if the C ++ implementation of select method using the mle is correct
TEST_P(ParBicopTest, bicop_select_mle_bic_is_correct)
{
  std::vector<int> positive_rotations = { 0, 180 };
  auto true_family = bicop_.get_family_name();
  auto true_rotation = bicop_.get_rotation();
  FitControlsBicop controls(
    { BicopFamily::indep, BicopFamily::gaussian, bicop_.get_family() },
    "mle",
    "quadratic",
    1.0,
    "bic");
  if (needs_check_) {
    auto data = bicop_.simulate(get_n());
    auto bicop = Bicop(data, controls);
    EXPECT_EQ(bicop.loglik(data), bicop.get_loglik()) << bicop_.str();
    EXPECT_NO_THROW(bicop.loglik());
    EXPECT_NO_THROW(bicop.aic());
    EXPECT_NO_THROW(bicop.bic());
    EXPECT_NO_THROW(bicop.mbic());
    auto selected_family = bicop.get_family_name();
    EXPECT_EQ(selected_family, true_family)
      << bicop_.str() << std::endl
      << bicop.bic(data) << " " << bicop_.bic(data);
    if (is_member(bicop_.get_family(), bicop_families::bb)) {
      int rot_sel = bicop.get_rotation();
      if (is_member(true_rotation, positive_rotations)) {
        EXPECT_TRUE(is_member(rot_sel, positive_rotations));
      } else {
        EXPECT_FALSE(is_member(rot_sel, positive_rotations));
      }
    } else {
      EXPECT_EQ(bicop.get_rotation(), true_rotation)
        << bicop_.str() << std::endl
        << bicop.bic(data) << " " << bicop_.bic(data);
    }
  }
}
TEST_P ( ParBicopTest , bicop_select_mle_bic_is_correct ) { std :: vector < int > positive_rotations = { 0 , 180 } ; auto true_family = bicop_ . get_family_name ( ) ; auto true_rotation = bicop_ . get_rotation ( ) ; FitControlsBicop controls ( { BicopFamily :: indep , BicopFamily :: gaussian , bicop_ . get_family ( ) } , " " , " " , 1.0 , " " ) ; if ( needs_check_ ) { auto data = bicop_ . simulate ( get_n ( ) ) ; auto bicop = Bicop ( data , controls ) ; EXPECT_EQ ( bicop . loglik ( data ) , bicop . get_loglik ( ) ) << bicop_ . str ( ) ; EXPECT_NO_THROW ( bicop . loglik ( ) ) ; EXPECT_NO_THROW ( bicop . aic ( ) ) ; EXPECT_NO_THROW ( bicop . bic ( ) ) ; EXPECT_NO_THROW ( bicop . mbic ( ) ) ; auto selected_family = bicop . get_family_name ( ) ; EXPECT_EQ ( selected_family , true_family ) << bicop_ . str ( ) << std :: endl << bicop . bic ( data ) << " " << bicop_ . bic ( data ) ; if ( is_member ( bicop_ . get_family ( ) , bicop_families :: bb ) ) { int rot_sel = bicop . get_rotation ( ) ; if ( is_member ( true_rotation , positive_rotations ) ) { EXPECT_TRUE ( is_member ( rot_sel , positive_rotations ) ) ; } else { EXPECT_FALSE ( is_member ( rot_sel , positive_rotations ) ) ; } } else { EXPECT_EQ ( bicop . get_rotation ( ) , true_rotation ) << bicop_ . str ( ) << std :: endl << bicop . bic ( data ) << " " << bicop_ . bic ( data ) ; } } }
Test if the C++ implementation of select method using the mle is correct
Test if the C ++ implementation of select method using the mle is correct