## 3 Data and Methods
### The Hierarchical Maximal Accessibility Equality (HMAE) Model  
The maximal equality model was developed by [PERSON] and [PERSON] [28]. It aims to achieve equal accessibility by minimizing the variation in the spatial accessibility to healthcare facilities from different demand nodes. In this study, the original MAE model was further adapted into a hierarchical version. The objective function can be expressed as Equation (1).  
\[minimize\sum_{i}^{m}P_{i}\left(A_{i}^{l}-\frac{\sum_{i}^{m}P_{i}A_{i}^{l}}{ \sum_{i}^{m}P_{i}}\right)^{2} \tag{1}\]  
where \(A_{i}^{l}\) is the spatial accessibility at demand node \(i\) to facilities at level \(l\), \(P_{i}\) is the population, and \(m\) is the number of demand nodes (i.e., communities in this study). The function means the population-weighted sum of the difference between the accessibility at each node and the population-weighted average accessibility. In the original study, spatial accessibility is calculated using the 2 SFCA method. The generalized form of 2 SFCA can be written as Equation (2).  
\[A_{i}^{l}=\sum_{j}^{n}\frac{S_{j}^{l}f(d_{ij})}{\sum_{k}^{m}P_{k}f(d_{kj})} \tag{2}\]  
where \(S_{j}^{l}\) is the supply size (amount of physicians in this study) at candidate level-\(l\) facility location \(j\), \(n\) is the amount of candidate facility locations, \(d_{ij}\) is the travel cost (e.g., travel time or distance) between each demand node and each candidate facility location, and \(f\) is a function that describes the distance friction effect. In this study, the Gaussian-based 2 SFCA method is adopted to measure spatial accessibility, which is advocated by existing studies on measuring healthcare accessibility [16]. The model takes a Gaussian distance friction function that is suitable for hierarchical facilities, which can be expressed as Equation (3):  
\[f(d_{ij})=\left\{\begin{array}{c}\frac{e^{-1/2\times(d_{ij}^{l}/D_{l})^{2}}- e^{-1/2}}{1-e^{-1/2}},\;d_{ij}\leq D_{l}\\ 0,\;d_{ij}>D_{l}\end{array}\right. \tag{3}\]  
where \(D_{l}\) is the catchment area size, i.e., the radius of service scope, of candidate facility at level \(l\). Note that in the traditional spatial accessibility and maximal equality optimization studies, the catchment area is the same for all facilities. When applied to hierarchical facilities, however, this setting is inappropriate. Following existing studies on the spatial accessibility to hierarchical healthcare facilities [32], we assigned different catchment sizes for facilities at different levels. Generally, the catchment size is larger for facilities at a higher level. Furthermore, on the basis of the Gaussian function, a larger catchment size also means a weaker distance friction for higher levels, which is another important characteristic of hierarchical healthcare facilities [32]. Note that the HMAE model in this study intends to maximize the equality of accessibility to healthcare facilities for each level independently. The reason for this setting is that the current hierarchical healthcare system in Shenzhen is a multi-flow and nested hierarchical system, where facilities at various levels provide service to residents independently [16].