I developed these files for the class Estimation of Rare Events and Failure Probabilities at the Technical University of Munich.
A function, g, of two random variables was given. In addition, the CDF of each random variable was provided. Using this information, I derived the marginal PDFs, as well as the joint PDF, for the random variables.
I applied the inverse transform method to the marginal CDFs in order to sample from the provided distributions. Using the Monte Carlo simulation, I estimated the probability that the provided function, g, exceeds 0. In addition, I estimated the coefficient of variation, as well as the 95% confidence interval for the estimate.
Next, I estimated the same probability using MCMC. This approach is useful when the CDF is not analytically invertible or the distribution is only known point-wise.
Specifically, I applied the random walk sampler. This approach generates a sample in the standard normal space and either accepts or rejects it, based on a comparison with the acceptance ratio. This ratio is a function of the joint PDF. This allows the user to sample from this joint PDF without having to analytically invert it.
Finally, I have included several files related to approximating the probability of failure of a truss, using subset simulation:
truss_subsetSim_main.m
: main file which defines inputs and allows user to choose from three different run typessubsetSim.m
: subset simulation algorithmtruss_exam.m
: simple finite element code provided by professor to calculate max nodal displacement, using a vector of 10 random variables as inputERADist.m
: code developed by TUM ERA department to generate statistical distributions, available hereERANataf.m
: code developed by TUM ERA department to perform the Nataf transformation, available here
Subset simulation is a method which utilizes MCMC and intermediate thresholds to iteratively generate samples closer and closer to the failure domain. Compared to classic MC, much fewer samples are needed, especially when working with very low probabilities of failure.
Subset simulation relies on an initial stage of Monte Carlo simulation, followed by various iterations/subsets based on MCMC simulations. The initial MC stage provides N random samples, which are used to evaluate the limit state function g(X) and to define the intermediate threshold, γ. Then, in each subsequent subset, seeds are selected based on the p value and the previous evaluations of g. Chains from each seed are constructed by using the conditional sampling Metropolis-Hastings algorithm. Based on a given ρ value and the current sample, a new sample is generated. It is evaluated against the current threshold, γ, and it is either accepted or rejected. In this way, new samples are generated closer and closer to the desired threshold, γ = 0.