def test_constructor_from_model(self): from openalea.stat_tool.compound import Compound from openalea.stat_tool.mixture import Mixture from openalea.stat_tool.convolution import Convolution from openalea.stat_tool.distribution import Binomial Renewal(Compound(Binomial(0,10,0.5), Binomial(0,10,0.3)), Type="Equilibrium", ObservationTime=20) Renewal(Mixture(0.1, Binomial(0,10,0.5), 0.9, Binomial(0,10,0.3)), Type="Equilibrium", ObservationTime=20) Renewal(Compound(Binomial(0,10,0.5), Binomial(0,10,0.3)), Type="Equilibrium", ObservationTime=20)
def test_compound_two_distribution(self): """test to be checked""" cdist1 = Compound("data/compound1.cd") chisto1 = Simulate(cdist1, 200) cdist2 = Estimate(chisto1, "COMPOUND", ExtractDistribution(cdist1, "Sum"), "Sum", InitialDistribution=\ ExtractDistribution(cdist1, "Elementary")) # If we call the method directly, we need to provide # the default values and perform a conversion. # Default is LIKELIHOOD -1 -1.0 SECOND_DIFFERENCE ZERO, which # corresponds to 0, -1,-1,1,0 # In addition because the type is 's', the 2 distributions # must be reversed. cdist3 = chisto1.compound_estimation1( ExtractDistribution(cdist1, "Elementary"), ExtractDistribution(cdist1, "Sum"), 's', _stat_tool.LIKELIHOOD, -1, -1., _stat_tool.SECOND_DIFFERENCE, _stat_tool.ZERO) assert str(cdist2) == str(cdist3)
def test_constructor_from_dists_and_threshold(self): compound1 = self.data compound2 = Compound(Binomial(2, 5, 0.5), NegativeBinomial(0, 2, 0.5), Threshold=0.99999) assert str(compound1) == str(compound2)
def build_data(self): d1 = Binomial(2, 5, 0.5) d2 = NegativeBinomial(0, 2, 0.5) comp = Compound(d1, d2) return comp
def test_simulate_compound(): c = Compound("data/compound1.cd") s1 = Simulate(c, 1000) assert s1
def create_data(self): comp = Compound(str(get_shared_data('test_compound1.cd'))) return comp.simulate(1000)
def comp(self): d1 = Binomial(2, 5, 0.5) d2 = NegativeBinomial(0, 2, 0.5) c = Compound(d1, d2) return c
def test_compound(self): comp = Compound("data/compound1.cd") comp_histo = Simulate(comp, 200) _histo = ExtractHistogram(comp_histo, "Sum") _histo = ExtractHistogram(comp_histo, "Elementary")
def comp_data(self): d1 = Binomial(0, 10, 0.5) d2 = NegativeBinomial(0, 1, 0.1) comp = Compound(d1, d2) comp_data = comp.simulate(self.N) return comp_data
def _test_moving_average_and_compound(self): """test to be implemented""" compound = Compound(Binomial(1, 10, 0.5), Binomial(1, 5, 0.4)) Regression(self.vector, "MovingAverage", 1, 2, compound)