Analysis of Factors Inﬂuencing the Urban Carrying Capacity of the Shanghai Metropolis Based on a Multiscale Geographically Weighted Regression (MGWR) Model

: With the rapid development of urban economy and the continuous expansion of urban scale, the limitations of urban carrying capacity begin to appear. For the sustainable development of the city, more and more scholars are paying attention to the research onurban carrying capacity. Basedon the continuous research of the authors’ research group over the past ten years, this paper uses a multiscale geographically weighted regression model and method to explore the impact of geographical location, ﬂoor area ratio, public transportation, residents’ consumption level, the density of high-tech enterprises, and the ecological environment on the carrying capacity of the Shanghai metropolis. The results show that (1) the impact of geographical location on the bearing capacity decreases from downtown to the outer areas and from the northeastern area to the southwestern area of Shanghai. (2) On the whole, the elasticity of the average ﬂoor area ratio to the urban carrying capacity is 0.52%. In different regions, most of the central urban areas have exceeded the optimal average plot ratio. With an increase in the average plot ratio, the urban carrying capacity presents a downward trend. Other sample areas generally did not reach the average optimal plot ratio, especially the southwestern area of Shanghai. With an increase in the average plot ratio, the urban carrying capacity of this area improved signiﬁcantly. (3) The elasticity of public transportation convenience to the urban carrying capacity is 0.23%; that is, the average increase in the urban carrying capacity is 0.23% for every 1% increase in public transportation convenience. The elasticity of residents’ consumption level is − 0.18%; in other words, every 1% increase in residents’ consumption level will reduce the urban carrying capacity by 0.18% on average. The elasticity of the density of high-tech enterprises is 0.08%; hence, when the density of high-tech enterprises increases by 1%, the urban carrying capacity increases by 0.08% on average. Lastly, the elasticity of the eco-environmental status index is 0.17%; that is, every 1% increase in the eco-environmental status index increases the urban carrying capacity by 0.17% on average.


Introduction
With the rapid development of industrialization and urbanization, a large number of rural people have flooded into cities, the scale of urban construction land has continued to expand, and the resource and environmental constraints of large cities are becoming increasingly prominent. In the face of challenges of high quality and sustainable development, research on the mechanism of urban carrying capacity also deserves much attention. In Shanghai, with the continuous improvement of land development intensity, the expansion of construction land over many years has rendered the urban ecological space and public space obviously insufficient. The separation of jobs from housing and residents' long-distance commuting have caused serious traffic congestion in the morning and evening rush hours. Environmental problems, such as poor air and water quality and garbage sieges still need to be further improved. The spatial distribution of industries, cities and people is unbalanced, and the urban spatial structure needs to be optimized. As one of the most economically developed cities in China and one of the rising global cities, Shanghai is a benchmark for the future development of many mega-cities in developing countries. Shanghai's development experience and the problems and challenges it faces are of reference value to other rising global cities. Therefore, clarifying the key constraints of, and regional differences in, Shanghai's urban carrying capacity from the spatial perspective is helpful for revealing the shortcomings of the carrying capacity and can provide a reference for exploring the carrying capacity of Shanghai in accordance with local conditions.
Most previous studies regarded the factors influencing urban carrying capacity as homogeneous, and their heterogeneity are often ignored; that is, the influencing factors are considered to be spatially stationary, or the regression coefficient is unchanged [1][2][3][4]. In a study on the ecological capacity of urban agglomeration in the middle reaches of the Yangtze River, Shen et al. [5] thought that the regression coefficients of health care level and urban-rural residents' income ratio were 0.478 and 0.119, respectively, and remained unchanged. In reality, the urban carrying capacity of a region is not homogeneous and unified; instead, the influence degree of the same factor on the urban carrying capacity differs among regions. Floor area ratio is one of the important factors affecting urban carrying capacity, but it is a double-edged sword. When the floor area ratio is within the most reasonable range, its increase will increase the land use efficiency and use level and thereby enhance the urban carrying capacity. However, if this ratio exceeds the most reasonable value range, the inevitable result is crowding of the population and their residences, which will inhibit the urban carrying capacity. Relevant studies have found that, compared with OLS regression, the spatial lag model is more suitable for revealing the internal mechanism of this relationship [6][7][8][9][10][11][12]. The least square method is no longer the optimal linear unbiased estimation method because the appearance of spatial autocorrelation violates the hypothesis of the spherical disturbance term in classical linear regression. Although the traditional spatial regression model includes the spatial dependence effect in the model, it still cannot deal with the problem of spatial heterogeneity. Zhu and He [13] believe that the urban carrying capacity of a region can be subdivided into multiple types, and each type contains different influencing factors or regression parameters. Compared with the unification of the whole domain, the effect of using subdivision type regression alone is better. Pi et al. [14] found that there are heteroscedasticity problems in the influence of transportation convenience and ecological environment on the urban carrying capacity. All these studies show that, with respect to the urban carrying capacity, both heterogeneity and spatial nonstationarity exist and are among its influencing factors. In summary, the relationship between independent and dependent variables changes with geographical location.
Additionally, among existing studies, there is a lack of attention to the scale differences in the spatial heterogeneities of different influencing factors. In fact, different independent variables have different scales of influence on dependent variables [15]. We often distinguish between micro and macro processes, as well as local and global processes [16]. There should be a deeper understanding of the "spatial scale effect" of social and economic phenomena in rapidly developing cities. Complex geographical phenomena are usually determined by multiple spatial processes at different scales. The academic community lacks the cross-scale description ability to interpret the mechanism of urban carrying capacity, which is ultimately due to the lack of efficient mathematical models. Because traditional mathematical models do not consider the influence scales of different factors, they capture too much noise. Consequently, the results have an insufficient explanatory power. In research on the mechanism of the metropolitan urban carrying capacity, the influence scales of different factors are also very important [17].
The functional orientation and development characteristics of different administrative districts in Shanghai vary. Different geographical locations, floor area ratio restriction policies, or incentive policies will cause divergent effects on the urban carrying capacity [18]. In addition, other scholars have studied the impact of transportation convenience and the density of high-tech enterprises on carrying capacity [19][20][21]. However, because consumption level and ecological environment are not easy to measure, they have attracted less attention than other factors from researchers.
In summary, compared with previous studies, this paper contributes the following: (1) the multiscale geographically weighted regression (MGWR) model has been successfully applied to analyse the impact mechanism of the urban carrying capacity, which makes up for the defects of traditional research in that the regression coefficient remains unchanged and the influence scales of the factors are the same. (2) The spatial effect of each factor on the carrying capacity is quantified at the micro level, which deepens the understanding of the influencing mechanism of the urban carrying capacity. (3) The analysis framework of the factors influencing the urban carrying capacity is enriched by including residents' consumption level and an eco-environmental quality index.
The remainder of the paper is organized as follows: Section 2 introduces the study area and the data sources. Section 3 presents the methods used in this paper. Section 4 shows the research results and analysis. Section 5 discusses some of the questions in the article. Finally, Section 6 concludes the paper.

Study Area
Shanghai is one of the four municipalities directly under the central government of China. Its rapid development over the past 30 years has made it an important centre of the world's economy, finance, trade, and shipping, as well as one of the most vibrant scientific, technological innovation and cultural metropolises in the world. As one of the most economically developed cities in China and a rising global city, Shanghai is a benchmark city for the future development of developing countries [22]. Hence, research on Shanghai is of great significance.
From the perspective of feasibility, if the statistical indicators of the 16 districts in Shanghai are directly used for regression, the problem of false regression may occur if there are not enough regression samples. From the perspective of consistency, because Chongming District is not entirely connected with the main area of Shanghai and its functional orientation and development layout are quite heterogeneous, the factors influencing its carrying capacity will be different from those of the main area of Shanghai. Therefore, Chongming District is not considered here, and only the 125 connected main areas in Shanghai are taken as the sample study area in this paper ( Figure 1).

Influencing Factors and Data Processing
The urban carrying capacity is not only determined by internal factors, such as resources, the environment, the economy, and society, but is also influenced by many external factors. The influencing factors studied by scholars mostly focus on land use, living service level, high-tech layout, policy and regulation formulation, the urban ecological environment, and transportation convenience [23]. Table 1 lists most of the independent variables used by scholars in studies on the factors influencing the urban carrying capacity [19,[24][25][26][27][28][29][30][31][32][33][34][35].
In our previous studies, the impact of natural resources and the environment on the urban carrying capacity of Shanghai was analysed in detail [27,36,37]. Therefore, this paper focuses on the impact of social and economic factors on urban carrying capacity.

Influencing Factors and Data Processing
The urban carrying capacity is not only determined by internal factors, such resources, the environment, the economy, and society, but is also influenced by ma external factors. The influencing factors studied by scholars mostly focus on land u living service level, high-tech layout, policy and regulation formulation, the urb ecological environment, and transportation convenience [23]. Table 1 lists most of t independent variables used by scholars in studies on the factors influencing the urb carrying capacity [24][25][26][27][28][29][30][31][32][33][34][35]19].   First, since the goal of Shanghai's urban master planning (2035 plan) is to build it into a city of humanity, innovation, and ecology with global influence, the urban ecology index is still included in the index system in this paper. Second, from the perspective of the development history of human society, with an improvement in science and technology, the urban carrying capacity also tends to rise. However, since the density of high-tech enterprises is considered separately in this paper, and this index is a comprehensive reflection of regional scientific and technological innovation strength, other indicators of scientific and technological innovation are temporarily not considered in order to avoid repetition. Third, policies and regulations are difficult variables to measure and will not be discussed in this paper. Therefore, on the basis of referring to previous research results, this paper mainly selects six factors, namely, location, the average floor area ratio, public transportation convenience, residents' consumption level, high-tech enterprise density, and the urban ecological environment status index, toanalyse the impact of these factors on urban carrying capacity. The selection basis and calculation method of each influencing factor are given below.
(1) Location. Location is one of the basic factors affecting urban carrying capacity. It can be understood as the advantages and disadvantages of location, which reflects the inherent attributes of each sample. In a traditional spatial regression or linear regression model, the practical significance of the intercept term is not obvious. In the multiscale geographically weighted regression model, the intercept term represents the influence of location on the dependent variable. In essence, when all the regression coefficients are 0, the intercept term will change among geographical locations. Computing the intercept term in multiscale geographically weighted regression is equivalent to incorporating all factors related to geographical location [38].
(2) Average floor area ratio (AFAR). The plot ratio usually refers to the ratio between the total floor area and the plot area of a certain parcel in a city [39]. Generally, if the plot ratio is appropriate, the density of the population will match the overall comfort level of living. However, as a factor influencing the urban carrying capacity, the average floor area ratio is no longer for a certain plot, but for each sample area, which has a larger scope. Average plot ratio refers to the ratio of the total area of all buildings in each sample area to the total area of each sample area, and its calculation method is shown in Equation (1): where AFAR j represents the average plot ratio of sample area j, S j represents the total area of sample area j, S ij represents the area of plot spot i in sample area j, and F ij represents the layer height of plot spot i in sample area j. The outer contour data of the urban buildings in Shanghai contain the story height (F ij ) attribute of the spot. The calculation results of the final average floor area ratio are shown in Figure 2.
(3) Public transport convenience (PTC). This term refers to the extent to which public transportation can save time for the convenience of travel in daily life [40]. There are five types of public transportation in Shanghai: subways, buses, taxis, ferries, and maglev trains. First, among the public transportation types in Shanghai, the maglev train has only one line, which renders it an unideal form of mass transportation. Second, taxis and ferries account for only approximately 2% of the public transport capacity. Therefore, the convenience of public transportation in this paper is mainly the weighted superposition of the network density and the number of subway stations, and its calculation method is shown in Equation (2). The weight is the sharing proportion of subways (0.62) and buses (0.38) in the public transport capacity after removing taxis, ferries, and maglev trains.
where PTC j represents the convenience of public transportation in the j-th sample area, Road j represents the road network density in the j-th sample area, Subway j represents the density of subway stations in the j-th sample area, and S j represents the area of the j-th sample area. Finally, the public transportation convenience of the sample study area is shown in Figure 3.  (3) Public transport convenience (PTC). This term refers to the extent to which public transportation can save time for the convenience of travel in daily life [40]. There are five types of public transportation in Shanghai: subways, buses, taxis, ferries, and maglev trains. First, among the public transportation types in Shanghai, the maglev train has only one line, which renders it an unideal form of mass transportation. Second, taxis and ferries account for only approximately 2% of the public transport capacity. Therefore, the convenience of public transportation in this paper is mainly the weighted superposition of the network density and the number of subway stations, and its calculation method is shown in Equation (2). The weight is the sharing proportion of subways (0.62) and buses (0.38) in the public transport capacity after removing taxis, ferries, and maglev trains.
represents the convenience of public transportation in the j-th sample area, represents the road network density in the j-th sample area, represents the density of subway stations in the j-th sample area, and represents the area of the j-th sample area. Finally, the public transportation convenience of the sample study area is shown in Figure 3.  (4) Consumption level of residents (CLR). This term refers to the extent to which people consume material products and services in order to satisfy their own lives and development [41]. The greater the quantity and the higher the quality of the material goods and services consumed, the higher the level of consumption is. This paper uses the (4) Consumption level of residents (CLR). This term refers to the extent to which people consume material products and services in order to satisfy their own lives and development [41]. The greater the quantity and the higher the quality of the material goods and services consumed, the higher the level of consumption is. This paper uses the POI (Point of Interest) data related to residents' consumption in the Baidu POI for measurement. More than 92,000 pieces of information were obtained from these related POI points through sorting and the removal of "dirty" data, which were eventually divided into dozens of subcategories, such as commercial complexes, restaurants, supermarkets, and general markets. The calculation method is shown in Equation (3): where CLR j is the consumption level of residents in the j-th sample area, N j is the total number of POIs related to residents' consumption in the j-th sample area, and S j is the total area of the j-th sample area. The calculation results for the final consumption level of residents are shown in Figure 4, and they can be divided into five levels.  (5) High-tech enterprise density (HED). Because the density of high-tech enterprises is an important indicator reflecting the degree of the high-tech layout, it is chosen as a factor influencing the urban carrying capacity. High-tech enterprise density is measured by the ratio of the number of high-tech companies or enterprises in each sample to the area. The measurement method for the density of high-tech enterprises is shown in Equation (4): (5) High-tech enterprise density (HED). Because the density of high-tech enterprises is an important indicator reflecting the degree of the high-tech layout, it is chosen as a factor influencing the urban carrying capacity. High-tech enterprise density is measured by the ratio of the number of high-tech companies or enterprises in each sample to the area. The measurement method for the density of high-tech enterprises is shown in Equation (4): where HTIL j is the density of high-tech enterprises in the j-th sample area, GSQY j is the number of high-tech enterprises in the j-th sample area, and S j is the total area of the j-th sample area. The measurement results for each sample are shown in Figure 5. (6) City ecological index (CEI). To study the impact of the ecological environment on the urban carrying capacity, it is necessary to evaluate the status of the urban ecological environment. According to the Ministry of Ecology and Environment of the PRC [42], urban ecological status assessment refers to the evaluation of urban ecological environmental quality by using the urban ecological environment index. This index adopts a two-level system to reflect the ecological environment of the city from three aspects: environmental pollution, pollution load, and ecological construction ( Table 2). The index is calculated as follows: = 0.64 * * + 0.36 * * (6) = 0.5 * * + 0.5 * * (7) = 0.5 * * + 0.5 * * (8) where is the urban ecological environment condition index of the j-th sample, with a value standardized to 0-100; is the environmental quality of the j-th sample; is (6) City ecological index (CEI). To study the impact of the ecological environment on the urban carrying capacity, it is necessary to evaluate the status of the urban ecological environment. According to the Ministry of Ecology and Environment of the PRC [42], urban ecological status assessment refers to the evaluation of urban ecological environmental quality by using the urban ecological environment index. This index adopts a two-level system to reflect the ecological environment of the city from three aspects: environmental pollution, pollution load, and ecological construction ( Table 2). The index is calculated as follows: where CEI j is the urban ecological environment condition index of the j-th sample, with a value standardized to 0-100; B 1j is the environmental quality of the j-th sample; B 2j is the pollution load of the j-th sample; B 3j is the ecological construction of the j-th sample; H ij is the i-th index of the j-th sample; A ij is the reference value of the normalized coefficient of the i-th index of the j-th sample (I = 1, 2, . . . , 6; J = 1, 2, . . . , 125). The measurement results for the CEI are shown in Figure 6. Overall, due to the relatively large proportion of ecological land in the suburbs, the urban ecological environment presents a decreasing trend from the suburbs to the centre.

Methods
Brunsdonet al. [43] proposed the geographically weighted regression (GWR) method. Based on the idea of local smoothing, geographically weighted regression uses the samples around the centre to carry out auxiliary regression in order to address the problems caused by nonstationary spatial processes. In geographically weighted

Methods
Brunsdonet al. [43] proposed the geographically weighted regression (GWR) method. Based on the idea of local smoothing, geographically weighted regression uses the samples around the centre to carry out auxiliary regression in order to address the problems caused by nonstationary spatial processes. In geographically weighted regression, it is generally believed that the regression coefficient has a certain degree of stationarity in space and changes smoothly. The vicinity of a central point can be regarded as approximately stationary and, in a way, the shorter the distance is, the more similar locations are deemed to be, which is in accordance with the first law of geography. The geographically weighted regression model is shown in Equation (9): where y i is the dependent variable, x ij is the j-th predictive variable, β j (u i , v i ) is the j-th regression coefficient, and ε i is the perturbation term. The optimization method of adding global variables into geographically weighted regression so that the regression coefficient of the global variables does not change is called semiparametric geographically weighted regression (SGWR) [44], as shown in Equation (10): where k a and k b represent the numbers of global and local variables, respectively, x ij (a) represents the j-th global variable, x il (b) represents the l-th local variable, a j represents the j-th global regression coefficient, b l (u i , v i ) represents the l-th local regression coefficient, ε i is the error term, and y i is the dependent variable. Although semiparametric geographically weighted regression can address globa and local scale problems to some extent, it still has some limitations. One of the basic assumptions is that all spatial processes with local coefficients are on the same scale, but this assumption is obviously impractical. Local variables can also exist in smaller-scale spatial processes or larger-scale spatial processes. By relaxing the hypothesis that all spatial processes are on the same scale, a multiscale geographically weighted regression (MGWR) model with more explanatory power can be obtained [17], as shown in Equation (11): where β bwj represents the j-th regression coefficient, bwj represents the j-th bandwidth, y i is the dependent variable, x ij is the j-th predictor variable, and ε i is the disturbance term. In this paper, logarithmic transformation was applied to the dependent variable and independent variable before establishing the regression equation, and derivation was conducted as shown in Equation (12) according to Equation (11). As ∆x ij and ∆y i are small, their differential is approximately equal to the difference. If ∆x ij x ij = 1%, then β bwj (u i , v i ) is the elasticity of the bearing capacity with respect to the j-th independent variable.
Land 2021, 10, 578 11 of 19 Figure 7 shows the surface of the regression coefficient of the location factors, and it describes the spatial trend change in the influence of location on the carrying capacities of different samples. The influence coefficient of location is between −2.695 and 2.805, with an average value of −0.05 (Table 3). The influence of location on the bearing capacity decreases from the central urban area to the surrounding area and from the northeastern area to the southwestern area of Shanghai. In general, there is an obvious "location dividing line," and the northeastern location has a more positive effect on the carrying capacity than the southwestern location. This structure is consistent with our perception of Shanghai, because the central urban area of Shanghai and the northeastern areas generally have excellent historical and cultural heritage and easy access to medical treatment. TheYangpu District in northeastern Shanghai has 14 colleges and universities, such as Fudan University and Tongji University, as well as a business centre-Wujiaochang, "Shanghai's third-generation international community"-New Jiangwan City, and the knowledge economy circle around Tongji University, with obvious geographical advantages. However, due to restrictions associated with industrial structure, transportation, education, and other factors, the location advantages of towns in southwestern Shanghai are not obvious. Yongfeng Street in the Songjiang Districtis affected by industrial agglomeration, with serious air pollution and relatively weak urban infrastructures.      Figure 8 shows the regression coefficient surface of the average plot ratio, which describes the spatial variation trend of the influence of the average plot ratio on the urban carrying capacity in different regions. The regression coefficient of the average plot ratio in the multiscale geographically weighted regression model was between −0.449 and 1.426, with an average value of 0.52 (Table 3). Overall, the average floor area ratio has a positive effect on the urban carrying capacity. The elasticity of the average floor area ratio to the urban carrying capacity is 0.52%; that is, every 1% increase in the average floor area ratio will increase the urban carrying capacity by 0.52% on average. Locally, the ratios for theJing'an District, Lujiazui Street, Weifang Xicun Street, Tangqiao Street and theHongkou District in downtown Shanghai exceeded the optimal average plot ratio. With an increase in the average plot ratio, the carrying capacity shows a downward trend. Taking Lujiazui Street as an example, the urban carrying capacity decreases by 0.43% when the average floor area ratio increases by 1%. In contrast to that of the downtown area, the average optimal plot ratio of the other areas is not reached. For instance, for Chuansha New Town in the Pudong New Area, the urban carrying capacity increases by approximately 0.64% for every 1% increase in the average floor area ratio. With an increase in the average floor area ratio, the carrying capacity of the outer suburbs of Shanghai increases obviously. For example, in Qingcun Town in theFengxian District, the carrying capacity of the city increases by 1.28% for every 1% increase in the average floor area ratio. Figure 9a shows the regression coefficient surface of public transportation convenience, which describes the spatial trend change in the influence of this convenience on the urban carrying capacity in different regions. On the whole, in the multiscale geographically weighted regression model, the regression coefficient of public transportation convenience is between 0.220 and 0.252, with an average value of 0.23 (Table 3), which can improve the urban carrying capacity. The regression coefficient of public transportation convenience changes little through space; therefore, the change in the regression coefficient can be explained directly by the overall perspective: the elasticity of public transportation convenience to the urban carrying capacity is 0.23%; that is, every 1% increase in public transportation convenience will increase the urban carrying capacity by approximately 0.23% on average. downtown area, the average optimal plot ratio of the other areas is not reached. For instance, for Chuansha New Town in the Pudong New Area, the urban carrying capacity increases by approximately 0.64% for every 1% increase in the average floor area ratio. With an increase in the average floor area ratio, the carrying capacity of the outer suburbs of Shanghai increases obviously. For example, in Qingcun Town in theFengxian District, the carrying capacity of the city increases by 1.28% for every 1% increase in the average floor area ratio.    Figure 9a shows the regression coefficient surface of public transportation convenience, which describes the spatial trend change in the influence of this convenience on the urban carrying capacity in different regions. On the whole, in the multiscale geographically weighted regression model, the regression coefficient of public transportation convenience is between 0.220 and 0.252, with an average value of 0.23 (Table 3), which can improve the urban carrying capacity. The regression coefficient of public transportation convenience changes little through space; therefore, the change in the regression coefficient can be explained directly by the overall perspective: the elasticity of public transportation convenience to the urban carrying capacity is 0.23%; that is, every 1% increase in public transportation convenience will increase the urban carrying capacity by approximately 0.23% on average.  Figure 9b shows the surface of the regression coefficient of residents' consumption level, which describes the spatial trend change in the influence of residents' consumption  Figure 9b shows the surface of the regression coefficient of residents' consumption level, which describes the spatial trend change in the influence of residents' consumption level on the urban carrying capacity in different areas. On the whole, the regression coefficient of residents' consumption level in the multiscale geographically weighted regression model is between −0.184 and −0.157, with an average value of −0.18 (Table 3), which indicates an inhibitory effect on the urban carrying capacity. Since the regression coefficient of residents' consumption level changes little through space, the change in the regression coefficient can be explained directly by the perspective of the whole city: the elasticity of residents' consumption level to the urban carrying capacity is −0.18%; that is, every 1% increase in residents' consumption level will reduce the urban carrying capacity by 0.18% on average. Figure 9c shows the surface of the regression coefficient of the density of high-tech enterprises, and it describes the spatial trend change of the impact of high-tech enterprise density in different sample areas on the city's carrying capacity. Overall, in the multiscale geographically weighted regression model, the average regression coefficient of the density of high-tech enterprises is 0.08 (Table 3), indicating that there is room for improvement in the urban carrying capacity. Because the regression coefficients for the density of hightech enterprises have small spatial differences, we can directly explain the changes in the regression coefficients from an overall perspective: the elasticity of the density of hightech enterprises to the city's carrying capacity is 0.08%; that is, for every 1% increase in the density of high-tech enterprises, the city's carrying capacity will increase by 0.08% on average. Figure 9d shows the surface of the regression coefficient of the urban eco-environmental status index, which describes the spatial trend change of the impact of the urban ecoenvironmental status index on the urban carrying capacity in different regions. In general, the regression coefficient of the urban ecological environment status index is between 0.168 and 0.180, with an average value of 0.17 (Table 3). The influence degree of the urban ecological environment status index shows a slow increasing trend from the south to the north of Shanghai. Although the regression coefficient of the urban ecological environment index presents different trends through space, the overall change is very small, which is explained by the perspective of the overall regression coefficient changes: the elasticity of the urban ecological environment index to the urban bearing capacity was 0.17%. Therefore, for every 1% increase in the urban ecological environment index, the bearing capacity of the city increases by 0.17% on average.

Discussion
When selecting a model, this article followed the idea of negating linear regression, introducing spatial regression, and selecting the best MGWR. With ordinary linear regression analysis, Moran's I of the error term is 0.53, and the P-value is 0.00, showing obvious spatial autocorrelation. This finding violates the assumption that the error term in classical linear regression is a spherical disturbance term. Because it does not meet the requirements of the Gauss-Markov theorem, the obtained estimate is not the best linear unbiased estimate, so a spatial regression model should be introduced. Traditional spatial regression models are represented by the spatial error model (SEM) and spatial lag model (SLM). According to the spatial dependence diagnosis (Table 4), the SEM is more significant than the SLM in the robust Lagrange multiplier test. Thus, the SEM is chosen as the representative of the traditional spatial regression model and compared with the multiscale geographically weighted regression model. As shown in Table 5, the goodness of fit R-squared of the MGWR is 0.92, which is significantly higher than the corresponding value of the SEM. In the SEM, the p-value of the intercept term coefficient is 0.22, which is not significant. In particular, the regression coefficient for the density of high-tech enterprises is not significant, which is not consistent with the expectation. In the comparison of Akaike's information criteria, the MGWR has a value of −194.57, which is 67.64 less than the value for the SEM. It is generally believed that when the Akaike information criterion is reduced by more than 30, the model is significantly improved [45]. From the above comparison, we can find that the reliability and explanatory power of the MGWR are significantly better than those of the SEM. Therefore, this article finally explains the spatial effect of different factors on the bearing capacity based on MGWR. The R-squared goodness of fit of the multiscale geographically weighted regression model is 0.92. Thus, location, average floor area ratio, public transportation convenience, residents' consumption level, density of high-tech enterprises, and the city ecological index can explain most of the urban carrying capacity, and only 8% cannot be explained. Among the six factors, public transportation convenience, density of high-tech enterprises, and the city ecological index have a positive effect, indicating that improving the accessibility of public transportation, enhancing the technological innovation ability of enterprises, and optimizing the urban ecological environment are conducive to improving urban carrying capacity. Residents' consumption level has a negative effect, which indicates that an increase in residents' food, energy, and other material consumption levels will reduce the urban carrying capacity. The effects of location and average floor area ratio are both positive and negative, indicating that there are objective optimal locations and average floor area ratios at the micro level. Historically, improvement of the level of science and technology will inevitably lead to an increase in the carrying capacity of the city. However, in the same period, due to the relatively small changes in the level of science and technology in each microregion, this level's impact on the city's carrying capacity is not significant. Therefore, this article selects the more significant high-tech enterprise density index to represent the technological level of each microregion.
In this paper, a Multiscale Geographically Weighted Regression (MGWR) model was used to quantitatively depict the spatial change trend of the effects of six factors on the urban carrying capacity. It not only makes up for the deficiency of linear regression and traditional spatial regression models, but also widens the application of this method in the study of urban carrying capacity and provides data support for the sustainable development of cities. However, this paper also has the following shortcomings: (1) although satisfactory results have been obtained using cross-sectional data in 2018 for regression analysis, we have not analysed the dynamic changes over time. (2) The spatial unit of this article is the town or subdistrict, and the variable facet problem is not discussed in depth. The variable facet problem is a common problem in economics and geography. It is worth examining whether the conclusions of this article apply to smaller villages or grid scales. (3) The selection of influencing factors can be further enriched or refined. For example, if dynamic changes in time are considered, the influence of factors such as technological level should be considered.

Conclusions
In this paper, the multiscale geographically weighted regression model is successfully applied to analyse the impact factors and mechanisms of the urban carrying capacity. In terms of the effect of the model, multiscale geographically weighted regression solves the defect whereby traditional regression models must assume that the factors are spatially stable and have the same influence scale. In terms of the accuracy of the model, the goodness of fit of the multiscale geographically weighted regression is 0.92, which is more explanatory than the spatial error model. From the perspective of the complexity of the model, the Akaike information criterion for multiscale geographically weighted regression is −194.57, which is smaller than that of the spatial error model.
According to the regression results, the influence of geographical location on the carrying capacity decreases from the central urban area to the surrounding area and from the northeastern area to the southwestern area of Shanghai. It can be seen from the surface of the regression coefficient that there is an obvious dividing line between the northeastern area and the southwestern area of Shanghai. The influence scale of geographical location is 20, and the fact that this scale is the smallest scale among all variables implies that its heterogeneity is the largest. Overall, the elasticity of the average plot ratio to the urban carrying capacity is 0.52%; that is, every 1% increase in the average plot ratio will increase the urban carrying capacity by 0.52% on average. In different regions, most of the central urban areas have exceeded the optimal average plot ratio. With an increase in the average plot ratio, the urban carrying capacity presents a downward trend. Other sample areas, especially the southwestern area of Shanghai, generally failed to reach the optimal average plot ratio. In these places, with an increase in the average floor area ratio, the urban carrying capacity improved significantly. The influence scale of the average floor area ratio is 36, and its heterogeneity is lower than that of geographical location.
The elasticity of public transportation convenience to the city's carrying capacity is 0.23%; that is, for every 1% increase in public transportation convenience, the city's carrying capacity will increase by 0.23% on average. The elasticity of residents' consumption level is −0.18%; that is, for every 1% increase in residents' consumption level, the city's carrying capacity will decrease by 0.18% on average. The elasticity of the density of high-tech enterprises is 0.08%, which implies that every 1% increase in the density of high-tech enterprises will increase the urban carrying capacity by 0.08% on average. The elasticity of the eco-environmental status index is 0.17%; hence, every 1% increase in the eco-environmental status index will increase the urban carrying capacity by 0.17% on average. The scale of public transportation convenience is 121, and the scales of residents' consumption level, the density of high-tech enterprises, and the city ecological index are 124. Compared with the 125 samples, these factors' scale is relatively large and is equivalent to the global factor; therefore, there is limited heterogeneity.
This paper quantitatively estimates the impact of six factors on the urban carrying capacity of Shanghai. Although the spatiotemporal geographically weighted regression model has been used by a few scholars, the significance test of the regression coefficient of the model itself has not been solved [46]. In future studies, first, it is necessary to include more variables (such as industrial structure, human capital or talent structure, etc.) into the MGWR model, so as to have a more comprehensive understanding of their impact on urban carrying capacity and develop more reasonable coping strategies. Second, we hope to optimize the MGWR model to better process and interpret panel data. Third, the application value of the research results can be further improved by effectively combining the research on urban carrying capacity at the micro scale with the detailed urban planning.

Institutional Review Board Statement: Not applicable.
Informed Consent Statement: Informed consent was obtained from all subjects involved in the study. Written informed consent has been obtained from the patient(s) to publish this paper.

Data Availability Statement:
The data presented in this study are available on request from the first author.

Conflicts of Interest:
The authors declare no conflict of interest.