Skip to content

Commit

Permalink
Explain current validation tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioannis-vm committed May 25, 2024
1 parent dfcae3d commit 6fed5ee
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
4 changes: 4 additions & 0 deletions pelicun/tests/validation/0/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Loss function validation test

In this example, a single loss function is defined as a 1:1 mapping of the input EDP.
This means that the resulting loss distribution will be the same as the EDP distribution, allowing us to test and confirm that this is what happens.
7 changes: 4 additions & 3 deletions pelicun/tests/validation/0/test_loss_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@
"""
Validation test on loss functions.
In this example, the loss function is a 1:1 mapping of the input EDP.
This means that the resulting loss distribution will be the same as
the EDP input distribution.
In this example, a single loss function is defined as a 1:1 mapping of
the input EDP. This means that the resulting loss distribution will
be the same as the EDP distribution, allowing us to test and confirm
that this is what happens.
"""

Expand Down
25 changes: 25 additions & 0 deletions pelicun/tests/validation/1/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Damage state probability validation test

Here we test whether we get the correct damage state probabilities for a single component with two damage states.
For such a component, assuming the EDP demand and the fragility curve capacities are all lognormal, there is a closed-form solution for the probability of each damage state.
We utilize those equations to ensure that the probabilities obtained from our Monte-Carlo sample are in line with our expectations.

## Equations

If $Y \sim \textrm{LogNormal}(\delta, \beta)$, then $X = \log(Y) \sim \textrm{Normal}(\mu, \sigma)$ with $\mu = \log(\delta)$ and $\sigma = \beta$.

```math
\mathrm{P}(\mathrm{DS}=0) = 1 - \Phi\left(\frac{\log(\delta_D) - \log(\delta_{C1})}{\sqrt{\beta_{C1}^2 + \beta_{C1}^2}}\right)
```

```math
p1 = \Phi\left(\frac{\log(\text{demand\_median}) - \log(\text{capacity\_1\_median})}{\sqrt{\text{demand\_beta}^2 + \text{capacity\_beta}^2}}\right) - \Phi\left(\frac{\log(\text{demand\_median}) - \log(\text{capacity\_2\_median})}{\sqrt{\text{demand\_beta}^2 + \text{capacity\_beta}^2}}\right)
```

```math
p2 = \Phi\left(\frac{\log(\text{demand\_median}) - \log(\text{capacity\_2\_median})}{\sqrt{\text{demand\_beta}^2 + \text{capacity\_beta}^2}}\right)
```

where $\Phi$ is the cumulative distribution function of the standard normal distribution.

The equations inherently asume that the capacity RVs for the damage states are perfectly correlated, which is the case for sequential damage states.

0 comments on commit 6fed5ee

Please sign in to comment.