# Quantifying Privacy Risks for Continuous Trait Data
## 5 Synthetic Data Generation
### Implementation of the Synthetic Data Generator  
What our synthetic data generator needs to generate is the QTL dataset, which needs to generate the continuous trait data \(\mathbb{T}^{*}\) and its corresponding SNP data \(\mathbb{S}^{*}\). As described in our previous work [53], there are four steps for data generation:  
First, we need to determine the structure of the dataset. Let \(m_{t}^{*}=m_{s}^{*}=m,n_{t}^{*}=n_{s}^{*}=n\), and for \(0<i\leqslant m,0<j\leqslant n\), let \(\mathbb{T}^{*}(\cdot,j)\) and \(\mathbb{S}^{*}(\cdot,j)\) be the same individual and let \(\Omega(i)=\mathbb{S}^{*}(i,\cdot)\), which means that the most correlated SNP of \(\mathbb{T}^{*}(i,\cdot)\) is \(\mathbb{S}^{*}(i,\cdot)\). Then we pre-set the parameters \(m,n\) for the synthetic data generator. Next, we need to formalize the distributions of \(\mathbb{T}^{*}(i,\cdot)\) corresponding with \(\mathbb{S}^{*}(i,\cdot)\). We define \(s_{1},s_{2},s_{3}\in\{AA,AB,BB\}\wedge s_{1}\
eq s_{2}\
eq s_{3}\). For each pair of \(\mathbb{T}^{*}(i,\cdot)\) and \(\mathbb{S}^{*}(i,\cdot)\), there are three distributions \(f_{T_{i}^{*}|s_{1}}f_{T_{i}^{*}|s_{2}}f_{T_{i}^{*}|s_{3}}\). The expectations of three distributions are randomly generated as \(\mu_{T_{i}^{*}|s_{1}},\mu_{T_{i}^{*}|s_{2}},\mu_{T_{i}^{*}|s_{3}}\), such that \(\mu_{T_{i}^{*}|s_{1}}<\mu_{T_{i}^{*}|s_{2}}<\mu_{T_{i}^{*}|s_{3}}\). We thirdly define the distance between two distributions. The distance between the two expectations \(\mu_{1}\) and \(\mu_{2}\) does not reflect the distance between distributions \(f_{1}\) and \(f_{2}\); even if the absolute value \(|\mu_{2}-\mu_{1}|\) is very large, the larger standard deviations \(\sigma_{1}\) and \(\sigma_{2}\) will also make \(f_{1}\) not far away from \(f_{2}\). To accurately describe the distance between two distributions, we define the _\(z\)-score_\(z\) as the ratio between the difference of expectations \(\mu_{2}-\mu_{1}\) and the sum of standard deviations \(\sigma_{1}+\sigma_{2}\):  
\[z=\frac{\mu_{2}-\mu_{1}}{\sigma_{1}+\sigma_{2}} \tag{6}\]  
We also define \(z_{\alpha}\) as the _\(z\)-score_ of \(f_{T_{i}^{*}|s_{1}}\) and \(f_{T_{i}^{*}|s_{2}}\), \(z_{\beta}\) as the _\(z\) score_ of \(f_{T_{i}^{*}|s_{2}}\) and \(f_{T_{i}^{*}|s_{3}}\). For each synthetic QTL dataset, all pairs of \(\mathbb{T}^{*}(i,\cdot)\) and \(\mathbb{S}^{*}(i,\cdot)\) in one QTL dataset use the same setting of \(z_{\alpha},z_{\beta}\). Then we pre-set the parameters \(z_{\alpha},z_{\beta}\) for the synthetic data generator. The final step is the generation of \(\mathbb{T}^{*}(i,j)\) and \(\mathbb{S}^{*}(i,j)\). Similarly with step 3, for each synthetic QTL dataset, all the \(S(i,\cdot)\) use the same setting of MAF value \(p_{\text{m}}\) to obtain the prior probability. The synthetic data generator first randomly generates the value of \(\mathbb{S}^{*}(i,j)\) as \(s_{1},s_{2},s_{3}\) based on the prior probability \(p_{s_{1}},p_{s_{2}},p_{s_{3}}\), and then generates \(\mathbb{T}^{*}(i,j)\) through the corresponding probability distribution \(f_{T_{i}^{*}|\mathbb{S}^{*}(i,j)}\). At last, we need to pre-set the parameters \(p_{\text{m}}\) for the synthetic data generator. As can be seen from the steps above, we need five parameters \(m,n,z_{a},z_{\beta},p_{\text{m}}\) as the input for the synthetic data generation in order to generate a synthetic QTL dataset. Referring to the findings from previous studies [21; 34; 35; 54], we choose four values for \(m\) as 50, 100, 200, and 300, respectively, and four values for \(n\) as 50, 100, 200, and 500, respectively. Similarly, referring to the relationship between standard deviation and cumulative probability in the standard normal distribution, we choose six values for both \(z_{a}\) and \(z_{\beta}\) as 0.13, 0.68, 1.29, 1.65, 2.33, and 2.58, respectively, which are corresponding to cumulative probabilities as 55%, 75%, 90%, 95%, 99%, and 99.5%, respectively. For MAF values \(p_{\text{m}}\), we choose 0.05, 0.15, 0.30, and 0.45, to roughly cover the value range of MAF (\(0<p_{\text{m}}\leqslant 0.5\)).