@Test public void testGetOddsRatio() { OddsRatioToClinicalConverter orc = new OddsRatioToClinicalConverter( ExampleData.buildMetaBenefitRiskAnalysis(), ExampleData.buildEndpointHamd()); Interval<Double> expected = new Interval<Double>(0.95, 1.25); assertEquals(expected, orc.getOddsRatio(expected)); }
@Test public void testGetRiskDifference() { Interval<Double> oddsRatio = new Interval<Double>(0.95, 1.25); Interval<Double> odds = new Interval<Double>( oddsRatio.getLowerBound() * d_baselineOdds, oddsRatio.getUpperBound() * d_baselineOdds); double expected = odds.getUpperBound() / (1 + odds.getUpperBound()) - odds.getLowerBound() / (1 + odds.getLowerBound()); assertEquals(expected, d_orc.getRiskDifference(oddsRatio), EPSILON); }
@Test public void testGetRisk() { Interval<Double> oddsRatio = new Interval<Double>(0.95, 1.25); Interval<Double> odds = new Interval<Double>( oddsRatio.getLowerBound() * d_baselineOdds, oddsRatio.getUpperBound() * d_baselineOdds); Interval<Double> expected = new Interval<Double>( odds.getLowerBound() / (1 + odds.getLowerBound()), odds.getUpperBound() / (1 + odds.getUpperBound())); assertEquals(expected.getLowerBound(), d_orc.getRisk(oddsRatio).getLowerBound(), EPSILON); assertEquals(expected.getUpperBound(), d_orc.getRisk(oddsRatio).getUpperBound(), EPSILON); }