# Analysis of the Railway Accident-Related Damages in South Korea
## 3 Two-Part Model  
The two-part model framework provides an appropriate structure for modeling two types of data--the non-negative count data and the semi-continuous data (2018; 2018). Let \(Y_{i}\) be the non-negative (or semi-continuous) outcome for subject \(i\) and \(\mathbf{x}_{i}=\big{(}X_{i1},X_{i2},\cdots X_{ip}\big{)}^{T}\) be a vector of covariates for subject \(i\); let \(\mathbf{\beta}=\big{(}\beta_{1},\beta_{2},\cdots\beta_{p}\big{)}^{T}\) be the parameter vector used in modeling the probability of positive responses and let \(\mathbf{\theta}=\big{(}\theta_{1},\theta_{2},\cdots\theta_{q}\big{)}^{T}\) represent the mean and the dispersion parameters of the conditional distribution of the positive responses. The two parts of the model can contain different sets of covariates but we have assumed that they are the same and use \(\{\mathbf{x}_{i},\,i=1,2,\cdots n\}\) for both parts of the model; hence, \(p=q\). Thus, the probability of a positive response can be denoted as \(p_{i}=P(Y_{i}>0|\mathbf{x}_{i},\mathbf{\beta})\) and the conditional distribution of the positive responses can be represented as \(g\omega\big{(}y_{i}|y_{i}>0,\mathbf{x}_{i}\big{)}\). Therefore, the distribution of the response, \(g\omega(y_{i}|\mathbf{x}_{i})\) is expressed as  
\[g\omega(y_{i}|\mathbf{x}_{i})=g\omega(y_{i}|y_{i}=0,\mathbf{x}_{i})\times\mathbf{I}(Y_ {i}=0)+g\omega\big{(}y_{i}|y_{i}>0,\mathbf{x}_{i}\big{)}\times(1-\mathbf{I}(Y_{i} =0)),\]  
where the indicator function, \(\mathbf{I}(Y_{i}=0)\) is defined such that if \(Y_{i}=0\) then, \(\mathbf{I}(Y_{i}=0)=1\), else, \(\mathbf{I}(Y_{i}=0)=0\). Thus, this framework results in the following mixed probability function and likelihood: for \(i=1,2,\cdots,n\),  
\[f\big{(}y_{i}|\mathbf{x}_{i},\mathbf{\beta},\mathbf{\theta})=\Big{[}(1-p_{i})+p_{i}\cdot g \omega(y_{i}|y_{i}=0,\mathbf{x}_{i})\Big{]}^{\mathbf{I}(y_{i}=0)}\times\Big{[}p_{ i}\cdot g\omega\big{(}y_{i}|y_{i}>0,\mathbf{x}_{i}\big{)}\Big{]}^{1-\mathbf{I}(y_{i}=0)}.\]  
\[L(\mathbf{\beta},\ \mathbf{\theta}|\mathbf{y},\ \mathbf{X})\ =\Big{[}\prod\
olimits_{y_{i}=0}(1-p_{i})+p_{i} \cdot g\omega(y_{i}|y_{i}=0,\mathbf{x}_{i})\Big{]}\prod\
olimits_{y_{i}>0}p_{i} \cdot g\omega\big{(}y_{i}|y_{i}>0,\mathbf{x}_{i}\big{)}\Big{]}. \tag{1}\]  
Here, \(\mathbf{y}=\left(Y_{1},Y_{2},\cdots,Y_{n}\right)^{T}\) and \(\mathbf{X}\) is a covariate matrix with a size of \(n\times p\). In case of non-negative count responses, \(g\omega(y_{i}|y_{i}=0,\mathbf{x}_{i})\) has its own positive probability whereas the distribution of semi-continuous measurements is \(g\omega\big{(}y_{i}|y_{i}>0,\mathbf{x}_{i}\big{)}=g\omega(y_{i}|\mathbf{x}_{i})\). Equation (1) can be factored into two parts: one related to the \(\mathbf{\beta}\) parameter vector involved in estimating \(p_{i}\)'s and the other with only the parameters involved in estimating the \(\mathbf{\theta}\) parameter vector. The first part (logit part) for estimating \(\mathbf{\beta}\) is expressed as follows:  
\[\text{logit}(p_{i})=\log\left(\frac{p_{i}}{1-p_{i}}\right)=\mathbf{x}_{i}^{T}\mathbf{ \beta}.\]  
In this study, we consider two different TPMs in terms of the measurement types of the dependent variable. In Section 3.1, the TPM for non-negative count measurements is introduced, especially ZIP and ZINB models. In Section 3.2, the TPM for non-negatively continuous measurements is introduced, including ZIG and ZILN models.