# Development of Stochastic Fatigue Model of Reinforcement for Reliability of Concrete Structures
## 2 Materials and Methods
### Bayesian Inference with Markov Chain Monte Carlo Implementation  
Bays' rule provides the mathematical basis to update beliefs (prior information) about a variable, \(\theta\), given observations, \(y\). By [PERSON] rule, the posterior probability of \(\theta\) given observations, \(p(\theta|y)\) is obtained as follows [35,36]:  
\[p(\theta|y)=\frac{p(\theta)p(y|\theta)}{p(y)}, \tag{7}\]  
Future predictions for \(y^{*}\) given observations \(y\) is obtained from the predictive distribution  
\[p(y^{*}|y)=\int p(y^{*}|\theta)p(\theta|y)d\theta, \tag{8}\]  
Thus, future predictions are modeled using the updated probability density function \(p(\theta|y)\) similar to making a prediction for \(y^{*}\) using a single value of \(\theta\) in the classical statistical sense. Equation (8) can be estimated using Monte Carlo simulation strategies such as the Markov-Chain Monte-Carlo algorithm [36]. By definition, a Markov chain simulation is a sequence of random variables \(\theta^{1},\ \theta^{2},\ \theta^{3},\ \dots\) for which for any \(k\), the distribution of \(\theta^{k}\) depends only on the most recent one \(\theta^{k-1}\). In practice, several independent sequences of Markov chain simulations are created. The Metropolis algorithm is used to obtain the transition distribution function [31]. It is an adaption of a random walk that uses an acceptance/rejection rule to converge to the specified target distribution. The step-by-step procedure is as follows [27]:  
Figure 3: Residuals Pattern: (**a**) without Run-outs; (**b**) with Run-outs. Figure 2: Histogram for Residuals: (**a**) without Run-outs; (**b**) with Run-outs. 1. Select initial parameter vector
2. Iterate as follows for \(k=1,\ 2,\ 3,\ \ldots\)  
1. Create a new trial position \(\theta^{*}=\theta^{k-1}+\Delta\theta\), where \(\Delta\theta\) is randomly sampled from the jumping distribution \(q(\Delta\theta)\). 2. Create the Metropolis ratio. \[r=\frac{\pi\Big{(}(\theta^{*}\big{|}y)\Big{)}}{\pi\Big{(}(\theta^{k-1}\big{|}y )\Big{)}}, \tag{9}\]
3. Accept a new sample if:  
\[\theta^{k}=\left\{ \begin{array}{ll}\theta^{*}&\text{with probability}\ \ min(r,1)\\ \theta^{k-1}&\text{otherwise}\end{array} \right., \tag{10}\]  
Note that this requires the jumping distribution to be symmetric: \(q\left(\theta^{*},\theta^{k-1}\right)=q\left(\theta^{k-1},\theta^{*}\right)\). If the jumping distribution is not symmetric, then the Metropolis-Hasting algorithm [37] can be used where both sides jumping distributions are part of the ratio. Since the posterior distribution can be calculated by Equation (7), where \(p(y)\) is a normalizing constant, it also follows that the posterior density function can be written as:  
\[p(\theta\big{|}y)\propto p(\theta)p(y\big{|}\theta), \tag{11}\]  
i.e., the posterior distribution is proportional to the product of the prior and the likelihood functions. If it is assumed that the prior distribution is the multivariate Normal distribution, then the Likelihood function becomes:  
\[p\Big{(}y\big{|}\theta,\sigma^{2}\Big{)}=\frac{1}{\sigma\sqrt{2\pi}}exp\Big{(} -\frac{1}{2\sigma^{2}}SS(\theta)\Big{)} \tag{12}\]  
where,  
\[SS(\theta)=\sum\
olimits_{i}^{n}\left(y-f(S,\theta)\right)^{2}, \tag{13}\]  
The Metropolis ratio becomes:  
\[r=\frac{p\Big{(}\theta^{*}\big{|}y,\sigma^{2}\Big{)}}{p(\theta^{k-1}\big{|}y,\sigma^{2})}=exp\Big{(}-\frac{1}{2\sigma^{2}}\Big{(}SS(\theta^{*})-SS\Big{(} \theta^{k-1}\big{)}\Big{)}\Big{)}, \tag{14}\]  
The scale reduction factor \(R\) indicates a potential scale reduction for the considered distribution when the number of samples goes to infinity (see [38] for theory and more detailed descriptions). The sampling is said to converge if \(R\) is close to one. Therefore, the number of simulations should be chosen such that \(R\) becomes as close to one as possible, and thereby, the Monte Carlo sampling error close to zero. The parameters fitted in the SN-curve in Equation (1) are \(K\) and \(m\). The correlation between them is illustrated in Figure 4. Here, the Markov Chain Monte Carlo algorithm is used.