Models Module
The Models module provides a variety of actuarial and statistical modeling tools for reinsurance pricing. It includes submodules for experience rating, exposure rating, and aggregate features modeling.
Submodules
Experience Rating
The Experience module provides tools for analyzing historical claims experience:
burn_cost: Methods for burn cost analysiscurve_fitting: Functions for fitting curves to datafrequency_severity: Tools for frequency-severity modelingpareto_rating: Pareto distribution-based rating methodsresampling: Methods for resampling claims data
Exposure Rating
The Exposure module provides tools for exposure-based rating:
mbbefd: Implementation of the Modified Beta Beta Equivalent Finite Difference (MBBEFD) distributionmixed_exponential: Implementation of the Mixed Exponential distributionpareto_ilf: Pareto distribution-based Increased Limit Factorsriebesell: Implementation of the Riebesell approximation
Aggregate Features
The AggregateFeatures module provides tools for modeling aggregate loss distributions:
aggregate_features: Methods for calculating aggregate loss statisticsselections: Tools for selecting and combining modelssimulation_engine: Monte Carlo simulation engine for aggregate losses
Trending
The trending module provides tools for trending historical data to current levels.
Examples
Experience Rating
Burn Cost Analysis
from pyre.Models.Experience.burn_cost import BurnCostModel
from pyre.claims.claims import Claims
import numpy as np
# Assuming we have a Claims collection called 'claims_data'
# Create a burn cost model
model = BurnCostModel(claims_data)
# Calculate basic burn cost statistics
burn_cost = model.calculate_burn_cost()
print(f"Average burn cost: {burn_cost}")
# Calculate burn cost with trend
trend_factor = 1.05 # 5% annual trend
years_of_trend = 2
trended_burn_cost = model.calculate_trended_burn_cost(trend_factor, years_of_trend)
print(f"Trended burn cost: {trended_burn_cost}")
# Calculate burn cost with limits
attachment = 1000000
limit = 5000000
limited_burn_cost = model.calculate_limited_burn_cost(attachment, limit)
print(f"Limited burn cost: {limited_burn_cost}")
# Calculate confidence intervals
confidence_level = 0.95
lower, upper = model.calculate_confidence_interval(confidence_level)
print(f"{confidence_level*100}% confidence interval: ({lower}, {upper})")
Frequency-Severity Modeling
from pyre.Models.Experience.frequency_severity import FrequencySeverityModel
from pyre.claims.claims import Claims
import numpy as np
import matplotlib.pyplot as plt
# Assuming we have a Claims collection called 'claims_data'
# Create a frequency-severity model
model = FrequencySeverityModel(claims_data)
# Fit frequency distribution (Poisson)
freq_params = model.fit_frequency_distribution("poisson")
print(f"Frequency distribution parameters: {freq_params}")
# Fit severity distribution (Lognormal)
sev_params = model.fit_severity_distribution("lognormal")
print(f"Severity distribution parameters: {sev_params}")
# Simulate aggregate losses
num_simulations = 10000
aggregate_losses = model.simulate_aggregate_losses(num_simulations)
# Calculate statistics
mean_loss = np.mean(aggregate_losses)
median_loss = np.median(aggregate_losses)
var_95 = np.percentile(aggregate_losses, 95)
var_99 = np.percentile(aggregate_losses, 99)
print(f"Mean aggregate loss: {mean_loss}")
print(f"Median aggregate loss: {median_loss}")
print(f"95% VaR: {var_95}")
print(f"99% VaR: {var_99}")
# Plot histogram of aggregate losses
plt.figure(figsize=(10, 6))
plt.hist(aggregate_losses, bins=50, alpha=0.7)
plt.axvline(mean_loss, color='r', linestyle='--', label=f'Mean: {mean_loss:.2f}')
plt.axvline(var_95, color='g', linestyle='--', label=f'95% VaR: {var_95:.2f}')
plt.axvline(var_99, color='b', linestyle='--', label=f'99% VaR: {var_99:.2f}')
plt.legend()
plt.title('Simulated Aggregate Loss Distribution')
plt.xlabel('Aggregate Loss')
plt.ylabel('Frequency')
plt.show()
Exposure Rating
Increased Limit Factors
from pyre.Models.Exposure.pareto_ilf import ParetoILF
import numpy as np
import matplotlib.pyplot as plt
# Create a Pareto ILF model
alpha = 2.0 # Pareto shape parameter
model = ParetoILF(alpha)
# Calculate increased limit factors
base_limit = 1000000
limits = [1000000, 2000000, 5000000, 10000000, 25000000]
ilfs = [model.calculate_ilf(base_limit, limit) for limit in limits]
print("Increased Limit Factors:")
for limit, ilf in zip(limits, ilfs):
print(f" {limit/1000000}M: {ilf:.4f}")
# Calculate layer costs
attachment = 5000000
limit = 5000000
layer_cost = model.calculate_layer_cost(attachment, attachment + limit)
print(f"Layer cost for {attachment/1000000}M xs {limit/1000000}M: {layer_cost:.4f}")
# Plot ILF curve
limits_plot = np.linspace(base_limit, 25000000, 100)
ilfs_plot = [model.calculate_ilf(base_limit, limit) for limit in limits_plot]
plt.figure(figsize=(10, 6))
plt.plot(limits_plot/1000000, ilfs_plot)
plt.scatter([l/1000000 for l in limits], ilfs, color='red', s=50)
plt.title('Pareto Increased Limit Factors')
plt.xlabel('Limit (Millions)')
plt.ylabel('ILF')
plt.grid(True)
plt.show()
Trending
from pyre.Models.trending import Trending
from pyre.claims.claims import Claims, Claim, ClaimsMetaData, ClaimDevelopmentHistory
from pyre.exposures.exposures import Exposures, Exposure, ExposureMetaData, ExposureValues
from datetime import date
import pandas as pd
# Create sample trend factors
exposure_trend_factors = {
2018: 1.05,
2019: 1.04,
2020: 1.03,
2021: 1.02,
2022: 1.01
}
claim_trend_factors = {
2018: 1.06,
2019: 1.05,
2020: 1.04,
2021: 1.03,
2022: 1.02
}
# Create a Trending instance
base_year = 2023
trending = Trending(
exposure_trend_factors=exposure_trend_factors,
claim_trend_factors=claim_trend_factors,
base_year=base_year
)
# Create sample exposures
exposures_list = [
Exposure(
ExposureMetaData(
exposure_id=f"EXP{year}",
exposure_name=f"Exposure {year}",
exposure_period_start=date(year, 1, 1),
exposure_period_end=date(year, 12, 31),
currency="USD"
),
ExposureValues(
exposure_value=1000 * (1 + 0.1 * (year - 2018)),
attachment_point=0,
limit=0
)
)
for year in range(2018, 2023)
]
# Create sample claims
claims_list = [
Claim(
ClaimsMetaData(
claim_id=f"CL{year}",
currency="USD",
loss_date=date(year, 6, 15)
),
ClaimDevelopmentHistory(
development_months=[0, 12],
cumulative_dev_paid=[0, 500 * (1 + 0.1 * (year - 2018))],
cumulative_dev_incurred=[1000 * (1 + 0.1 * (year - 2018)), 800 * (1 + 0.1 * (year - 2018))]
)
)
for year in range(2018, 2023)
]
# Create collections
exposures = Exposures(exposures_list)
claims = Claims(claims_list)
# Trend the exposures and claims to the base year
trended_exposures = trending.trend_exposures(exposures)
trended_claims = trending.trend_claims(claims)
# Print original and trended values
print("Original vs. Trended Exposures:")
for i, (orig, trended) in enumerate(zip(exposures, trended_exposures)):
year = 2018 + i
orig_value = orig.exposure_values.exposure_value
trended_value = trended.exposure_values.exposure_value
trend_factor = trending.calculate_trend_factor(year, for_claims=False)
print(f" {year}: Original=${orig_value:.2f}, Trended=${trended_value:.2f}, Factor={trend_factor:.4f}")
print("\nOriginal vs. Trended Claims (Latest Incurred):")
for i, (orig, trended) in enumerate(zip(claims, trended_claims)):
year = 2018 + i
orig_value = orig.uncapped_claim_development_history.latest_incurred()
trended_value = trended.uncapped_claim_development_history.latest_incurred()
trend_factor = trending.calculate_trend_factor(year, for_claims=True)
print(f" {year}: Original=${orig_value:.2f}, Trended=${trended_value:.2f}, Factor={trend_factor:.4f}")
# Get the trend factors
trend_factors = trending.get_trend_factors()
print("\nTrend Factors:")
print(" Exposure Trend Factors:", trend_factors['exposure'])
print(" Claim Trend Factors:", trend_factors['claim'])
# For backward compatibility, you can also use standalone functions
from pyre.Models.trending import calculate_trend_factor, trend_exposures, trend_claims
# Calculate a trend factor directly
origin_year = 2020
direct_trend_factor = calculate_trend_factor(origin_year, base_year, exposure_trend_factors)
print(f"\nDirect trend factor from {origin_year} to {base_year}: {direct_trend_factor:.4f}")
API Reference
BurnCostModel
BurnCostModel is a class that calculates burn costs for a reinsurance contract layer.
It uses various projection methods to estimate ultimate claims and calculate burn costs based on historical claims and exposures data.
Attributes:
| Name | Type | Description |
|---|---|---|
_modelling_years |
List[int]
|
The years to be used in the modelling. |
_years_weighting |
Dict[int, float]
|
Weighting factors for each modelling year. |
_projection_methods |
Dict[int, ProjectionMethods]
|
Projection method to use for each modelling year. |
_development_pattern |
Dict[int, float]
|
Development factors for each modelling year. |
_a_priori |
Dict[int, float]
|
A priori expected loss ratios for each modelling year. |
_data |
ExperienceModelData
|
The claims and exposures data for the reinsurance contract. |
_layer_id |
Any
|
The identifier for the reinsurance contract layer. |
Source code in src\pyre\Models\Experience\burn_cost.py
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 | |
a_priori
property
writable
Get the a priori expected loss ratios for each modelling year.
Returns:
| Type | Description |
|---|---|
Dict[int, float]
|
Dict[int, float]: Mapping of modelling year to a priori expected loss ratio. |
data
property
writable
Get the claims and exposures data for the reinsurance contract.
Returns:
| Name | Type | Description |
|---|---|---|
ExperienceModelData |
ExperienceModelData
|
The claims and exposures data. |
development_pattern
property
writable
Get the development factors for each modelling year.
Returns:
| Type | Description |
|---|---|
Dict[int, float]
|
Dict[int, float]: Mapping of modelling year to development factor. |
layer_id
property
writable
Get the identifier for the reinsurance contract layer.
Returns:
| Name | Type | Description |
|---|---|---|
Any |
Any
|
The layer identifier. |
modelling_years
property
writable
Get the years to be used in the modelling.
Returns:
| Type | Description |
|---|---|
List[int]
|
List[int]: The modelling years. |
projection_methods
property
writable
Get the projection method to use for each modelling year.
Returns:
| Type | Description |
|---|---|
Dict[int, ProjectionMethods]
|
Dict[int, ProjectionMethods]: Mapping of modelling year to projection method. |
years_weighting
property
writable
Get the weighting factors for each modelling year.
Returns:
| Type | Description |
|---|---|
Dict[int, float]
|
Dict[int, float]: Mapping of modelling year to weighting factor. |
__init__(model_data, layer_id, years_weighting=None, projection_methods=None, development_pattern=None, a_priori_assumption=None)
Initialize a BurnCostModel instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_data
|
ExperienceModelData
|
The claims and exposures data for the reinsurance contract. |
required |
layer_id
|
Any
|
The identifier for the reinsurance contract layer. |
required |
years_weighting
|
Optional[Dict[int, float]]
|
Weighting factors for each modelling year. If None, equal weights of 1.0 will be used for all years. Defaults to None. |
None
|
projection_methods
|
Optional[Dict[int, ProjectionMethods]]
|
Projection method to use for each modelling year. If None, SIMPLE_CAPE_COD will be used for all years. Defaults to None. |
None
|
development_pattern
|
Optional[Dict[int, float]]
|
Development factors for each modelling year. If None, factors of 1.0 will be used for all years (no development). Defaults to None. |
None
|
a_priori_assumption
|
Optional[Dict[int, float]]
|
A priori expected loss ratios for each modelling year. If None, values of 0.0 will be used for all years (no a priori assumption). Defaults to None. |
None
|
Source code in src\pyre\Models\Experience\burn_cost.py
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | |
calculate_burn_cost()
Calculate the burn cost for each modelling year.
This method applies the specified projection method for each modelling year to calculate the burn cost based on the claims and exposures data.
Returns:
| Type | Description |
|---|---|
Dict[int, float]
|
Dict[int, float]: Mapping of modelling year to calculated burn cost. |
Source code in src\pyre\Models\Experience\burn_cost.py
348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 | |
ProjectionMethods
Bases: Enum
Enumeration of available projection methods for burn cost calculations.
Source code in src\pyre\Models\Experience\burn_cost.py
146 147 148 149 150 151 152 153 | |
bf_method(data, exposure, development_factor, a_priori)
Apply the Bornhuetter-Ferguson method to project ultimate claims.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
float
|
The current claim amount. |
required |
exposure
|
float
|
The exposure amount. |
required |
development_factor
|
float
|
The development factor to apply. |
required |
a_priori
|
float
|
The a priori expected loss ratio. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The projected ultimate claim amount. |
Source code in src\pyre\Models\Experience\burn_cost.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 | |
cape_cod_method(data, exposure, development_factor, trend_factors=None, losses=None, development_factors=None, exposures=None)
Apply the Cape Cod method to project ultimate claims.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
float
|
The current claim amount. |
required |
exposure
|
float
|
The exposure amount. |
required |
development_factor
|
float
|
The development factor to apply. |
required |
trend_factors
|
List[float]
|
List of trend factors for each year. |
None
|
losses
|
List[float]
|
List of losses for each year. |
None
|
development_factors
|
List[float]
|
List of development factors for each year. |
None
|
exposures
|
List[float]
|
List of exposures for each year. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The projected ultimate claim amount. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If any of the required parameters for cape_cod_prior_algo are missing. |
Source code in src\pyre\Models\Experience\burn_cost.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | |
cape_cod_prior_algo(trend_factors, losses, development_factors, exposures, decay_factor=0.0, generalised=False)
Calculate the a priori expected loss ratio using the Cape Cod algorithm.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
trend_factors
|
List[float]
|
List of trend factors for each year. |
required |
losses
|
List[float]
|
List of losses for each year. |
required |
development_factors
|
List[float]
|
List of development factors for each year. |
required |
exposures
|
List[float]
|
List of exposures for each year. |
required |
decay_factor
|
float
|
Decay factor for the generalised method. Defaults to 0.0. |
0.0
|
generalised
|
bool
|
Whether to use the generalised method. Defaults to False. |
False
|
Returns:
| Type | Description |
|---|---|
Union[Any, float]
|
Union[Any, float]: The a priori expected loss ratio. |
Source code in src\pyre\Models\Experience\burn_cost.py
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | |
chainladder_method(data, development_factor)
Apply the Chain Ladder method to project ultimate claims.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
float
|
The current claim amount. |
required |
development_factor
|
float
|
The development factor to apply. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The projected ultimate claim amount. |
Source code in src\pyre\Models\Experience\burn_cost.py
6 7 8 9 10 11 12 13 14 15 16 17 | |
generalised_cape_cod_method(data, exposure, development_factor, trend_factors=None, losses=None, development_factors=None, exposures=None, decay_factor=0.0)
Apply the Generalised Cape Cod method to project ultimate claims.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
float
|
The current claim amount. |
required |
exposure
|
float
|
The exposure amount. |
required |
development_factor
|
float
|
The development factor to apply. |
required |
trend_factors
|
List[float]
|
List of trend factors for each year. |
None
|
losses
|
List[float]
|
List of losses for each year. |
None
|
development_factors
|
List[float]
|
List of development factors for each year. |
None
|
exposures
|
List[float]
|
List of exposures for each year. |
None
|
decay_factor
|
float
|
Decay factor for the generalised method. Defaults to 0.0. |
0.0
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The projected ultimate claim amount. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If any of the required parameters for cape_cod_prior_algo are missing. |
Source code in src\pyre\Models\Experience\burn_cost.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | |
assess_error_assumptions(actual, expected, num_parameters)
Assesses the error term based on standardized residuals and calculates: - The proportion of positive standardized residuals. - The proportion of standardized residuals outside the range (-2, 2).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
actual
|
List[float]
|
The actual observed values. |
required |
expected
|
List[float]
|
The expected values from the model. |
required |
num_parameters
|
int
|
The number of parameters in the model. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
A dictionary containing: - 'proportion_positive': Proportion of positive standardized residuals. - 'proportion_outside_range': Proportion of standardized residuals outside (-2, 2). - 'mean_residual': Mean of the standardized residuals. - 'std_residual': Standard deviation of the standardized residuals. |
Source code in src\pyre\Models\Experience\curve_fitting.py
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | |
exponential_fit(age_to_age_factors, time_periods)
Fits an exponential curve to the given age-to-age factors using the model: rj = exp(a + b * t), where ln(rj) = a + b * t.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
age_to_age_factors
|
List[float]
|
The incremental age-to-age factors (rj). |
required |
time_periods
|
List[int]
|
The corresponding time periods (t). |
required |
Returns:
| Type | Description |
|---|---|
Tuple[float, float]
|
List[float]: A list containing the parameters [a, b] of the exponential curve. |
Source code in src\pyre\Models\Experience\curve_fitting.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | |
inverse_power_fit(age_to_age_factors, time_periods, c_values)
Fits a Sherman Curve (Inverse Power Curve) to the given incremental age-to-age factors using the model: rj = a * (t + c)^b.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
age_to_age_factors
|
List[float]
|
The incremental age-to-age factors (rj). |
required |
time_periods
|
List[int]
|
The corresponding time periods (t). |
required |
c_values
|
List[float]
|
A list of candidate values for c to test. |
required |
Returns:
| Type | Description |
|---|---|
Tuple[float, float, float]
|
List[float]: A list containing the parameters [a, b, c] of the Sherman Curve. |
Source code in src\pyre\Models\Experience\curve_fitting.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | |
linear_regression(x, y)
Performs linear regression to calculate the slope and intercept.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
List[float]
|
The independent variable values. |
required |
y
|
List[float]
|
The dependent variable values. |
required |
Returns:
| Type | Description |
|---|---|
Tuple[float, float]
|
Tuple[float, float]: The slope and intercept of the regression line. |
Source code in src\pyre\Models\Experience\curve_fitting.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | |
power_fit(age_to_age_factors, time_periods)
Fits a power curve to the given cumulative age-to-age factors using the model: Rj = a * (b^t), where ln(ln(Rj)) = ln(ln(a)) + (ln(b) * t).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
age_to_age_factors
|
List[float]
|
The cumulative age-to-age factors (Rj). |
required |
time_periods
|
List[int]
|
The corresponding time periods (t). |
required |
Returns:
| Type | Description |
|---|---|
Tuple[float, float]
|
List[float]: A list containing the parameters [a, b] of the power curve. |
Source code in src\pyre\Models\Experience\curve_fitting.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |
r_squared(actual, expected)
Calculates the R-squared (coefficient of determination) value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
actual
|
List[float]
|
The actual observed values. |
required |
expected
|
List[float]
|
The expected values from the model. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The R-squared value. |
Source code in src\pyre\Models\Experience\curve_fitting.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | |
weibull_fit(age_to_age_factors, time_periods)
Fits a Weibull curve to the given cumulative age-to-age factors using the model: Rj = 1 / (1 - exp(-a * t^b)).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
age_to_age_factors
|
List[float]
|
The cumulative age-to-age factors (Rj). |
required |
time_periods
|
List[int]
|
The corresponding time periods (t). |
required |
Returns:
| Type | Description |
|---|---|
Tuple[float, float]
|
List[float]: A list containing the parameters [a, b] of the Weibull curve. |
Source code in src\pyre\Models\Experience\curve_fitting.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |
severity_fit
Source code in src\pyre\Models\Experience\frequency_severity.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | |
fit()
Fit the severity distribution to the data. This method should implement the logic to fit the specified severity distributions to the data provided in the ExperienceModelData instance.
Source code in src\pyre\Models\Experience\frequency_severity.py
31 32 33 34 35 36 37 38 | |
resampling
A class for resampling claims data from an ExperienceModelData object.
This class provides functionality to randomly select claims from a set of trended claims for the purpose of simulation or bootstrapping analysis. It uses the random.choice function to select individual claims from the trended claims data.
Attributes:
| Name | Type | Description |
|---|---|---|
_claims |
A collection of trended claims from the ExperienceModelData object. These are claims that have been adjusted to the contract inception year. |
Note
Future enhancements planned include support for different return periods and more sophisticated resampling methods. The implementation relies on the Claims class having an iterator method to work with the random.choice function.
Source code in src\pyre\Models\Experience\resampling.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | |
__init__(claims)
Initialize the resampling class with claims data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
claims
|
ExperienceModelData
|
An ExperienceModelData object containing the claims to be resampled. The trended_claims property of this object will be used for resampling. |
required |
Source code in src\pyre\Models\Experience\resampling.py
22 23 24 25 26 27 28 29 30 31 | |
resample()
Randomly select a claim from the collection of trended claims.
This method uses the random.choice function to select a single claim from the trended claims data. Currently, it doesn't return the selected claim but this behavior may change in future implementations.
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
Currently doesn't return anything, but may be updated to return the selected claim in future implementations. |
Note
Future enhancements will include support for different return periods and more sophisticated resampling methods.
Source code in src\pyre\Models\Experience\resampling.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | |
swissRe_c_values
Bases: Enum
summary https://www.swissre.com/dam/jcr:7137dac0-83a6-4cfa-80a4-93d33c35562f/exposure-rating-brochure.pdf
Source code in src\pyre\Models\Exposure\exposure_curve_functions.py
20 21 22 23 24 25 26 27 28 29 30 31 | |
calculate_curve(curve_type, parameters, position)
Calculate curve value based on curve type and parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
curve_type
|
ExposureCurveType
|
Type of curve to use |
required |
parameters
|
Dict[str, Any]
|
Dictionary containing curve-specific parameters |
required |
position
|
float
|
Position on the curve |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Calculated curve value |
Source code in src\pyre\Models\Exposure\exposure_curve_functions.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | |
mbbefd_curve(curve, curve_position)
Calculate the MBBEFD curve value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
curve
|
Union[swissRe_c_values, float]
|
Either a swissRe_c_values enum or a manual c-value as float |
required |
curve_position
|
float
|
Position on the curve |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The calculated curve value |
Source code in src\pyre\Models\Exposure\exposure_curve_functions.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | |
mixed_exponential_curve(paramaters_mus, parameter_weights, curve_position_value)
summary
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
paramaters_mus
|
list[float]
|
description |
required |
parameter_weights
|
list[float]
|
description |
required |
curve_position_value
|
float
|
description |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
description |
Source code in src\pyre\Models\Exposure\exposure_curve_functions.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | |
riebesell_curve(attachment, limit, z_value, base_limit)
summary
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
attachment
|
float
|
description |
required |
limit
|
float
|
description |
required |
z_value
|
float
|
description |
required |
base_limit
|
float
|
description |
required |
Returns:
| Name | Type | Description |
|---|---|---|
_type_ |
description |
Source code in src\pyre\Models\Exposure\exposure_curve_functions.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | |
CredibilityWeight
Source code in src\pyre\Models\AggregateFeatures\selections.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 | |
__init__(experience_data, exposure_data)
Initialize the CredibilityWeight class with experience and exposure data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
experience_data
|
ExperienceModelData
|
Experience model data containing claims and exposures |
required |
exposure_data
|
ExposureModelData
|
Exposure model data containing exposures |
required |
Source code in src\pyre\Models\AggregateFeatures\selections.py
7 8 9 10 11 12 13 14 15 16 | |
bayesian_credibility(prior_mean, prior_variance, data, data_variance)
Calculate credibility using Bayesian Credibility approach.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prior_mean
|
float
|
Mean of the prior distribution |
required |
prior_variance
|
float
|
Variance of the prior distribution |
required |
data
|
List[float]
|
List of observed values |
required |
data_variance
|
float
|
Variance of the data |
required |
Returns:
| Type | Description |
|---|---|
float
|
Credibility factor between 0 and 1 |
Source code in src\pyre\Models\AggregateFeatures\selections.py
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 | |
buhlmann_credibility(claim_count, expected_process_variance, variance_of_hypothetical_means)
Calculate credibility using the Bühlmann Credibility method. Based on the formula Z = n / (n + k) where k = EPV / VHM.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
claim_count
|
int
|
Number of claims |
required |
expected_process_variance
|
float
|
Expected value of the process variance (EPV) |
required |
variance_of_hypothetical_means
|
float
|
Variance of the hypothetical means (VHM) |
required |
Returns:
| Type | Description |
|---|---|
float
|
Credibility factor between 0 and 1 |
Source code in src\pyre\Models\AggregateFeatures\selections.py
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | |
buhlmann_straub_credibility(exposures, claim_counts, expected_process_variance, variance_of_hypothetical_means)
Calculate credibility using the Bühlmann-Straub Credibility method. This extends the Bühlmann method to account for varying exposure sizes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exposures
|
List[float]
|
List of exposure values |
required |
claim_counts
|
List[int]
|
List of claim counts corresponding to each exposure |
required |
expected_process_variance
|
float
|
Expected value of the process variance (EPV) |
required |
variance_of_hypothetical_means
|
float
|
Variance of the hypothetical means (VHM) |
required |
Returns:
| Type | Description |
|---|---|
float
|
Credibility factor between 0 and 1 |
Source code in src\pyre\Models\AggregateFeatures\selections.py
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | |
calculate_data_variance(data, method='sample')
Calculate the variance of data using different methods.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
List[float]
|
List of observed values |
required |
method
|
str
|
Method to use for variance calculation: "sample" - standard sample variance "population" - population variance "process" - estimate of process variance for credibility |
'sample'
|
Returns:
| Type | Description |
|---|---|
float
|
Variance of the data based on the specified method |
Source code in src\pyre\Models\AggregateFeatures\selections.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | |
calculate_sample_variance(data)
Calculate the sample variance of a list of data points.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
List[float]
|
List of observed values |
required |
Returns:
| Type | Description |
|---|---|
float
|
Sample variance of the data |
Source code in src\pyre\Models\AggregateFeatures\selections.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | |
estimate_process_variance(data_by_group)
Estimate the process variance (within variance) from grouped data. This is useful for Bühlmann and Bühlmann-Straub credibility methods.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_by_group
|
Dict[Any, List[float]]
|
Dictionary mapping group identifiers to lists of observed values |
required |
Returns:
| Type | Description |
|---|---|
float
|
Estimated process variance |
Source code in src\pyre\Models\AggregateFeatures\selections.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | |
estimate_variance_of_hypothetical_means(data_by_group)
Estimate the variance of hypothetical means (between variance) from grouped data. This is useful for Bühlmann and Bühlmann-Straub credibility methods.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_by_group
|
Dict[Any, List[float]]
|
Dictionary mapping group identifiers to lists of observed values |
required |
Returns:
| Type | Description |
|---|---|
float
|
Estimated variance of hypothetical means |
Source code in src\pyre\Models\AggregateFeatures\selections.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | |
greatest_accuracy_credibility(data, collective_mean)
Calculate credibility using the Greatest Accuracy Credibility method. This method aims to minimize the mean squared error.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
List[float]
|
List of observed values |
required |
collective_mean
|
float
|
The collective mean (a priori estimate) |
required |
Returns:
| Type | Description |
|---|---|
float
|
Credibility factor between 0 and 1 |
Source code in src\pyre\Models\AggregateFeatures\selections.py
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | |
limited_fluctuation_credibility(claim_count, full_credibility_standard=1082)
Calculate credibility using the Limited Fluctuation (Classical) Credibility method. Based on the formula Z = min(sqrt(n/n_full), 1) where n_full is the full credibility standard.
The default full_credibility_standard of 1082 corresponds to a 95% confidence level with a 5% margin of error assuming a Poisson frequency process.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
claim_count
|
int
|
Number of claims |
required |
full_credibility_standard
|
int
|
Number of claims needed for full credibility |
1082
|
Returns:
| Type | Description |
|---|---|
float
|
Credibility factor between 0 and 1 |
Source code in src\pyre\Models\AggregateFeatures\selections.py
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | |
Exposures
A container class for managing a collection of Exposure objects.
This class provides list-like behavior for storing and manipulating multiple Exposure instances. It supports indexing, slicing, iteration, and appending new exposures.
Attributes:
| Name | Type | Description |
|---|---|---|
exposures |
List[Exposure]
|
The list of Exposure objects managed by this container. |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exposures
|
List[Exposure]
|
A list of Exposure objects to initialize the container. |
required |
Methods:
| Name | Description |
|---|---|
append |
Exposure): Appends an Exposure object to the collection. |
__getitem__ |
Returns an Exposure or a new Exposures instance for slices. |
__iter__ |
Returns an iterator over the exposures. |
__len__ |
Returns the number of exposures in the collection. |
Source code in src\pyre\exposures\exposures.py
387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 | |
exposures
property
writable
Returns the list of Exposure objects managed by this container.
modelling_years
property
Returns a sorted list of unique modelling years for all exposures.
Returns:
| Type | Description |
|---|---|
List[int]
|
List[int]: A sorted list of unique modelling years. |
__getitem__(key)
Get an Exposure object by index or a slice of Exposures.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
An integer index or a slice object. |
required |
Returns:
| Type | Description |
|---|---|
|
Union[Exposure, 'Exposures']: An Exposure object if key is an integer, or a new Exposures instance if key is a slice. |
Source code in src\pyre\exposures\exposures.py
439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 | |
__iter__()
Return an iterator over the exposures.
Returns:
| Type | Description |
|---|---|
|
Iterator[Exposure]: An iterator over the Exposure objects. |
Source code in src\pyre\exposures\exposures.py
455 456 457 458 459 460 461 | |
__len__()
Return the number of exposures in the collection.
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
The number of Exposure objects. |
Source code in src\pyre\exposures\exposures.py
463 464 465 466 467 468 469 | |
append(exposure)
Append an Exposure object to the collection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exposure
|
Exposure
|
The Exposure object to append. |
required |
Source code in src\pyre\exposures\exposures.py
431 432 433 434 435 436 437 | |
Selections
Source code in src\pyre\Models\AggregateFeatures\selections.py
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 | |
__init__(experience_data, exposure_data, credibility_weight=None)
Initialize the Selections class with experience and exposure data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
experience_data
|
ExperienceModelData
|
Experience model data containing claims and exposures |
required |
exposure_data
|
ExposureModelData
|
Exposure model data containing exposures |
required |
credibility_weight
|
Optional[CredibilityWeight]
|
Optional CredibilityWeight object for calculating weights |
None
|
Source code in src\pyre\Models\AggregateFeatures\selections.py
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 | |
calculate_experience_weight(method='limited_fluctuation', **kwargs)
Calculate the weight to assign to experience rating.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
method
|
str
|
Credibility method to use ("limited_fluctuation", "buhlmann", "buhlmann_straub", "greatest_accuracy", or "bayesian") |
'limited_fluctuation'
|
**kwargs
|
Additional parameters for the credibility method |
{}
|
Returns:
| Type | Description |
|---|---|
float
|
Weight for experience rating between 0 and 1 |
Source code in src\pyre\Models\AggregateFeatures\selections.py
316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 | |
exposure_weight()
Get the weight to assign to exposure rating.
Returns:
| Type | Description |
|---|---|
float
|
Weight for exposure rating between 0 and 1 |
Source code in src\pyre\Models\AggregateFeatures\selections.py
416 417 418 419 420 421 422 423 | |
make_selection(experience_result, exposure_result, method='limited_fluctuation', **kwargs)
Make a selection by calculating weights and combining results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
experience_result
|
float
|
Result from experience rating method |
required |
exposure_result
|
float
|
Result from exposure rating method |
required |
method
|
str
|
Credibility method to use |
'limited_fluctuation'
|
**kwargs
|
Additional parameters for the credibility method |
{}
|
Returns:
| Type | Description |
|---|---|
float
|
Selected result based on weighted average |
Source code in src\pyre\Models\AggregateFeatures\selections.py
440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 | |
unlimited_selection(experience_result, exposure_result)
Selects the unlimited option for the subject contract by combining experience and exposure results based on their weights.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
experience_result
|
float
|
Result from experience rating method |
required |
exposure_result
|
float
|
Result from exposure rating method |
required |
Returns:
| Type | Description |
|---|---|
float
|
Weighted average of experience and exposure results |
Source code in src\pyre\Models\AggregateFeatures\selections.py
425 426 427 428 429 430 431 432 433 434 435 436 437 438 | |
calculate_curve(curve_type, parameters, position)
Calculate curve value based on curve type and parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
curve_type
|
ExposureCurveType
|
Type of curve to use |
required |
parameters
|
Dict[str, Any]
|
Dictionary containing curve-specific parameters |
required |
position
|
float
|
Position on the curve |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Calculated curve value |
Source code in src\pyre\Models\Exposure\exposure_curve_functions.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | |
Trending
A class for trending insurance data (claims and exposures) to a common base year.
This class provides methods to apply trend factors to claims and exposures, adjusting their values to account for inflation or other time-based changes.
Attributes:
| Name | Type | Description |
|---|---|---|
exposure_trend_factors |
Dict[int, float]
|
Mapping of year to annual trend factor for exposures (e.g., {2020: 1.02, 2021: 1.03, ...}). |
claim_trend_factors |
Dict[int, float]
|
Mapping of year to annual trend factor for claims (e.g., {2020: 1.02, 2021: 1.03, ...}). |
base_year |
int
|
The year to which all data will be trended. |
Source code in src\pyre\Models\trending.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | |
__init__(exposure_trend_factors, claim_trend_factors=None, trend_factors=None, base_year=None)
Initialize the Trending class with trend factors and a base year.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exposure_trend_factors
|
Dict[int, float]
|
Mapping of year to annual trend factor for exposures (e.g., {2020: 1.02, 2021: 1.03, ...}). |
required |
claim_trend_factors
|
Dict[int, float]
|
Mapping of year to annual trend factor for claims. If None, exposure_trend_factors will be used for claims as well. |
None
|
trend_factors
|
Dict[int, float]
|
For backward compatibility. If provided, both exposure_trend_factors and claim_trend_factors will be set to this value. |
None
|
base_year
|
int
|
The year to which all data will be trended. |
None
|
Source code in src\pyre\Models\trending.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | |
calculate_trend_factor(origin_year, for_claims=False)
Calculate the trend factor between the origin year and the base year.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
origin_year
|
int
|
The year from which to trend. |
required |
for_claims
|
bool
|
If True, use claim trend factors. If False, use exposure trend factors. Defaults to False. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The calculated trend factor. |
Source code in src\pyre\Models\trending.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | |
get_trend_factors()
Get the trend factors from this Trending instance.
Returns:
| Type | Description |
|---|---|
Dict[str, Dict[int, float]]
|
Dict[str, Dict[int, float]]: A dictionary with keys 'exposure' and 'claim', each mapping to their respective trend factors dictionary. |
Source code in src\pyre\Models\trending.py
122 123 124 125 126 127 128 129 130 131 132 133 | |
trend_claims(claims)
Apply trend factors to a collection of claims.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
claims
|
Claims
|
The original Claims object. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Claims |
Claims
|
A new Claims object with trended ClaimDevelopmentHistory for each claim. |
Source code in src\pyre\Models\trending.py
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | |
trend_exposures(exposures)
Apply trend factors to a collection of exposures.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exposures
|
Exposures
|
The original Exposures object. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Exposures |
Exposures
|
A new Exposures object with trended values. |
Source code in src\pyre\Models\trending.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | |
calculate_trend_factor(origin_year, base_year, trend_factors, for_claims=False)
Calculate the trend factor between the origin year and the base year.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
origin_year
|
int
|
The year from which to trend. |
required |
base_year
|
int
|
The year to which to trend. |
required |
trend_factors
|
Dict[int, float]
|
Mapping of year to annual trend factor. |
required |
for_claims
|
bool
|
If True, use as claim trend factors. If False, use as exposure trend factors. Defaults to False. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The calculated trend factor. |
Source code in src\pyre\Models\trending.py
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | |
get_trend_factors(trending_instance)
Get the trend factors from a Trending instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
trending_instance
|
Trending
|
The Trending instance to get trend factors from. |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Dict[int, float]]
|
Dict[str, Dict[int, float]]: A dictionary with keys 'exposure' and 'claim', each mapping to their respective trend factors dictionary. |
Source code in src\pyre\Models\trending.py
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | |
trend_claims(claims, trend_factors, base_year)
Apply trend factors to a collection of claims.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
claims
|
Claims
|
The original Claims object. |
required |
trend_factors
|
Dict[int, float]
|
Mapping of year to annual trend factor. |
required |
base_year
|
int
|
The year to which all claims will be trended. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Claims |
Claims
|
A new Claims object with trended ClaimDevelopmentHistory for each claim. |
Source code in src\pyre\Models\trending.py
217 218 219 220 221 222 223 224 225 226 227 228 229 230 | |
trend_exposures(exposures, trend_factors, base_year)
Apply trend factors to a collection of exposures.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exposures
|
Exposures
|
The original Exposures object. |
required |
trend_factors
|
Dict[int, float]
|
Mapping of year to annual trend factor. |
required |
base_year
|
int
|
The year to which all exposures will be trended. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Exposures |
Exposures
|
A new Exposures object with trended values. |
Source code in src\pyre\Models\trending.py
201 202 203 204 205 206 207 208 209 210 211 212 213 214 | |