Skip to content

Commit

Permalink
tests updated 21.2
Browse files Browse the repository at this point in the history
  • Loading branch information
gpitt71 committed Feb 21, 2024
1 parent 49bb0ce commit 1d23d17
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 277 deletions.
26 changes: 13 additions & 13 deletions gemact/tests/test_lossaggregation.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ def test_lossaggregation(self):
decimalPlace = 3

lossaggregate = gemact.LossAggregation(
margins=['genpareto', 'genpareto'],
margins_pars=[
{'loc': 0,
'scale': 1 / .9,
'c': 1 / .9},
{'loc': 0,
'scale': 1 / 1.8,
'c': 1 / 1.8}
],
copula='clayton',
copula_par={'par': 1.2, 'dim': 2}
)
margins=gemact.Margins(
dist=['genpareto', 'lognormal'],
par=[{'loc': 0, 'scale': 1/.9, 'c': 1/.9}, {'loc': 0, 'scale': 10, 'shape': 1.5}],
),
copula=gemact.Copula(
dist='frank',
par={'par': 1.2, 'dim': 2}
),
n_sim=500000,
random_state=10,
n_iter=8
)

self.assertAlmostEqual(lossaggregate.cdf(1, n_iter=7, method='aep'), 0.31583504136297336, decimalPlace)
self.assertAlmostEqual(lossaggregate.cdf(x=1, method='aep'), 0.021527811027268903, decimalPlace)

20 changes: 6 additions & 14 deletions gemact/tests/test_lossmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def test_computational_methods(self):
aggr_loss_dist_method='fft',
n_sev_discr_nodes=int(80),
sev_discr_step=1,
n_aggr_dist_nodes=int(100)
n_aggr_dist_nodes=int(256)
)


Expand All @@ -39,7 +39,7 @@ def test_computational_methods(self):
aggr_loss_dist_method='recursion',
n_sev_discr_nodes=int(80),
sev_discr_step=1,
n_aggr_dist_nodes=int(100)
n_aggr_dist_nodes=int(256)
)


Expand Down Expand Up @@ -68,30 +68,22 @@ def test_severity_discretization(self):
ld=severity.discretize(
discr_method='lowerdiscretization',
n_discr_nodes=50,
discr_step= 1,
deductible=0,
cover=np.inf)
discr_step= 1)

ud = severity.discretize(
discr_method='upperdiscretization',
n_discr_nodes=50,
discr_step= 1,
deductible=0,
cover=np.inf)
discr_step= 1)

md = severity.discretize(
discr_method='massdispersal',
n_discr_nodes=50,
discr_step= 1,
deductible=0,
cover=np.inf)
discr_step= 1)

lm = severity.discretize(
discr_method='localmoments',
n_discr_nodes=50,
discr_step= 1,
deductible=0,
cover=np.inf)
discr_step= 1)

print('Sum of probabilities md', np.sum(md['fj']))
print('probabilities ld', md['fj'][:5])
Expand Down
14 changes: 7 additions & 7 deletions gemact/tests/test_lossreserve.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ class TestLossModel(unittest.TestCase):
def test_AggregateData(self):

ip_ = gemact.gemdata.incremental_payments
in_ = gemact.gemdata.incurred_number
in_ = gemact.gemdata.payments_number
cp_ = gemact.gemdata.cased_payments
cn_ = gemact.gemdata.cased_number
cn_ = gemact.gemdata.open_number
reported_ = gemact.gemdata.reported_claims

ad = gemact.AggregateData(
incremental_payments=ip_,
cased_payments=cp_,
cased_number=cn_,
reported_claims=reported_,
incurred_number=in_)
incremental_payments=ip_,
cased_payments=cp_,
open_claims_number =cn_,
reported_claims=reported_,
payments_number=in_)

return ad

Expand Down
243 changes: 0 additions & 243 deletions gemact/tests/test_paperscripts.py

This file was deleted.

0 comments on commit 1d23d17

Please sign in to comment.