spec/fathom/distributions/gaussian_spec.rb in fathom-0.3.4 vs spec/fathom/distributions/gaussian_spec.rb in fathom-0.3.6

- old
+ new

@@ -16,11 +16,11 @@ Gaussian.rng.should_receive(:gaussian).and_return(0.5) Gaussian.rand(1) end it "should be able to generate an inverse CDF" do - Gaussian.inverse_cdf(@opts).should be_close(-0.16448, 0.00001) + Gaussian.inverse_cdf(@opts).should be_within(0.00001).of(-0.16448) end it "should require mean as an option for an inverse CDF" do @opts.delete(:mean) lambda{Gaussian.inverse_cdf(@opts)}.should raise_error @@ -31,23 +31,23 @@ lambda{Gaussian.inverse_cdf(@opts)}.should raise_error end it "should take std as an alias for sd when creating an inverse CDF" do @opts.delete(:sd) - Gaussian.inverse_cdf(@opts.merge(:std => 0.1)).should be_close(-0.16448, 0.00001) + Gaussian.inverse_cdf(@opts.merge(:std => 0.1)).should be_within(0.00001).of(-0.16448) end it "should take standard_deviation as an alias for sd when creating an inverse CDF" do @opts.delete(:sd) - Gaussian.inverse_cdf(@opts.merge(:standard_deviation => 0.1)).should be_close(-0.16448, 0.00001) + Gaussian.inverse_cdf(@opts.merge(:standard_deviation => 0.1)).should be_within(0.00001).of(-0.16448) end it "should be able to set upper to true and get Q instead of P" do - Gaussian.inverse_cdf(@opts.merge(:upper =>true)).should be_close(0.16448, 0.00001) + Gaussian.inverse_cdf(@opts.merge(:upper =>true)).should be_within(0.00001).of(0.16448) end it "should be able to take a different confidence interval" do - Gaussian.inverse_cdf(@opts.merge(:confidence_interval => 0.1)).should be_close(-0.12815, 0.00001) + Gaussian.inverse_cdf(@opts.merge(:confidence_interval => 0.1)).should be_within(0.00001).of(-0.12815) end it "should have a lower_bound alias for inverse_cdf" do Gaussian.lower_bound(@opts).should eql(Gaussian.inverse_cdf(@opts)) end