# Spatial and Temporal Variation of GPP and Its Response to Urban Environmental Changes in Beijing
## Data and Methods
### Methods
#### 2.3.5. Geographically and Temporally Weighted Regression  
The GTWR model offers a robust estimation approach by incorporating time and space data into its weight matrices, effectively capturing non-stationary spatial and temporal dynamics. This feature addresses the GWR model's limitation of handling only cross-sectional data [23]. Thus, the model can be formulated as:  
\[Y_{i}=\beta_{0}(u_{i},v_{i},t_{i})+\sum_{k=1}^{d}\beta_{k}(u_{i},v_{i},t_{i})x _{ik}+\varepsilon_{i} \tag{11}\]  
where \(i\) ranging from 1 to n. \(Y_{i}\) denotes an n \(\times\) 1 vector of explanatory variables, \(\beta_{0}\) is the constant coefficient, and \((u_{i},v_{i},t_{i})\) specifies the geographic and temporal coordinates of the observation. \(\beta_{k}(u_{i},v_{i},t_{i})\) is the unknown parameter for the kth factor at these coordinates, with \(x_{ik}\) representing the n \(\times\) k matrix of explanatory variables. Parameters are estimated using a locally weighted least squares approach, where nearby observations for a given point are assigned higher weights, and the difference between observed and fitted values is used to assign lower weights. The method minimizes the sum of squared differences to derive the parameter estimates. Constructing the GTWR model hinges on defining the spatial weight matrix. Typically, the space-time weight matrix is formulated as \(W(u_{i},v_{i},t_{i})=diag(w_{i1},\ w_{i2},\ldots,\ w_{in})\), with diagonal element \(W_{\rm ij}\) representing the spatiotemporal decay function. In this paper, according to the research of [PERSON] et al. [23], a Gaussian function is utilized as the weighting function. \[W_{\rm ij}=\exp\left(-\left(\frac{d_{ij}}{h}\right)^{2}\right) \tag{12}\]  
where \(h\) signifies the bandwidth that modulates the influence decay with distance, with its optimal value identified using the Corrected Akaike information criterion [31]. \(d_{\rm ij}\) denotes the space-time gap between points \(i\) and \(j\). To normalize disparities across dimensions, the GTWR model automatically adjusts the spatial scale parameter \(\lambda\) and the temporal scale parameter \(\mu\). The spatial distance \(d^{S}\) and the temporal distance \(d^{T}\) are integrated to form a composite spatiotemporal distance \(d^{ST}\), thereby enabling the formulation of a spatiotemporal distance function. \[d_{\rm ij}^{ST}=\sqrt{\lambda\left[\left(u_{\rm i}-u_{\rm j}\right)^{2}+\left( v_{\rm i}-v_{\rm j}\right)^{2}\right]+\mu\left(t_{\rm i}-t_{\rm j}\right)^{2}} \tag{13}\]  
where \(\lambda=0\) implies the absence of spatial effects, reducing the space-time distance to a function proportional to the time distance, thus converting the GTWR model into a basic time-weighted regression. Similarly, if \(\mu\) is zero, the model disregards temporal effects, effectively making it a GWR model. However, when both \(\lambda\) and \(\mu\) are non-zero, the GTWR model constructs a space-time weight matrix as \((u_{\rm i},v_{\rm i},t_{\rm i})=\text{diag}\left(w_{\rm i1},\ w_{\rm i2},\ldots, \ w_{\rm in}\right)\), and \(W_{\rm ij}\) can be calculated as below:  
\[W_{\rm ij}=\exp\left\{-\left(\frac{\lambda\left[\left(u_{i}-u_{j}\right)^{2}+ \left(v_{i}-v_{j}\right)^{2}\right]+\mu\left(t_{i}-t_{j}\right)^{2}}{h^{2}} \right)\right\} \tag{14}\]  
The GTWR model applies local regression to each observed unit, estimating parameters at different time points as geographical positions change. This approach better captures the spatial dependence and spatiotemporal differences of each driving factor. Compared with GWR, GTWR accounts for temporal non-stationarity and the integrated effects of space and time, rendering it apt for analyzing complex spatiotemporal data that requires consideration of both spatial and temporal factors. Due to the short time frame of our data, ranging from 2014 to 2020, and constraints in data availability, we will conduct GWR and GTWR analyses. This will allow us to compare the outcomes and choose the most appropriate method for our study. In this study, we function the GTWR ADDIN by [PERSON] et al.