Skip to content

Commit 4410083

Browse files
authored
Merge pull request #10 from SpatLyu/dev
draft ccd vignette
2 parents 0ae1d56 + 7155abb commit 4410083

10 files changed

Lines changed: 500 additions & 4 deletions

File tree

.Rbuildignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
^docs$
66
^pkgdown$
77
^cran-comments\.md$
8+
^build-vignettes\.md$

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
.DS_Store
66
.quarto
77
docs
8+
inst/doc

DESCRIPTION

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,15 @@ LinkingTo:
1717
Rcpp,
1818
RcppThread
1919
Suggests:
20+
gdverse,
2021
infoxtr,
22+
knitr,
2123
pc,
2224
Rcpp,
2325
RcppThread,
26+
rmarkdown,
27+
sdsfun,
2428
spEDM
29+
VignetteBuilder: knitr
2530
Config/roxygen2/markdown: TRUE
2631
Config/roxygen2/version: 8.0.0

_pkgdown.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ navbar:
1111
bg: custom
1212
components:
1313
articles:
14-
# text: Vignettes
15-
# menu:
16-
# - text: Coupling Coordination Degree Models
17-
# href: articles/ccd.html
14+
text: Vignettes
15+
menu:
16+
- text: Coupling Coordination Degree Model and Metacoupling Analysis
17+
href: articles/ccd.html
1818

1919
home:
2020
title: |

build-vignettes.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
``` r
2+
.prebuild_vignettes = \(name){
3+
out = paste0("vignettes/",name,".Rmd")
4+
inp = paste0(out,".orig")
5+
knitr::knit(inp,out)
6+
}
7+
8+
.prebuild_vignettes("ccd")
9+
```

man/figures/ccd/fig_ccd-1.png

145 KB
Loading
98.9 KB
Loading

vignettes/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.html
2+
*.R

vignettes/ccd.Rmd

Lines changed: 269 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,269 @@
1+
---
2+
title: "Coupling Coordination Degree Model and Metacoupling Analysis"
3+
author: "Wenbo Lyu"
4+
date: |
5+
| Last update: 2026-05-12
6+
| Last run: `r Sys.Date()`
7+
output: rmarkdown::html_vignette
8+
vignette: >
9+
%\VignetteIndexEntry{ccd}
10+
%\VignetteEngine{knitr::rmarkdown}
11+
%\VignetteEncoding{UTF-8}
12+
---
13+
14+
15+
16+
# Introduction
17+
18+
The **Coupling Coordination Degree (CCD) model** is widely used to quantify the degree of coupling and coordinated development among multiple subsystems. Originating from physics, it has been extensively applied in regional and human–environment systems.
19+
20+
## Coupling Degree
21+
22+
Given *n* normalized subsystem indicators $U_i$, the standard coupling degree $C$ is defined as:
23+
24+
$$
25+
C = \left[ \frac{\prod_{i=1}^{n} U_i}{\left( \frac{1}{n} \sum_{i=1}^{n} U_i \right)^n} \right]^{\frac{1}{n}}
26+
$$
27+
28+
Although widely used, this formulation may suffer from **scale sensitivity and over-amplification effects** due to the power structure. To address these issues, several formulations have been proposed by modifying the functional form of the coupling degree.
29+
30+
## Modified Coupling Degree
31+
32+
### Modification by $\text{wang et al}^{[1]}$.
33+
34+
**First**, Wang et al. introduce a formulation that incorporates pairwise differences among subsystems while normalizing their relative magnitudes:
35+
36+
$$
37+
C = \sqrt{\left[1-\frac{\sum\limits_{i>j,j=1}^{n-1} \sqrt{\left(U_i-U_j\right)^2}}{\sum_{m=1}^{n-1}m}\right] \times \left(\prod_{i=1}^n \frac{U_i}{\text{max} U_i}\right)^{\frac{1}{n-1}}}
38+
$$
39+
40+
### Modification by $\text{fan et al}^{[2]}$.
41+
42+
**Alternatively**, Fan et al. propose a simplified structure derived from variance-like dispersion, which directly captures the imbalance among subsystem indicators:
43+
44+
$$
45+
C = 1-2\sqrt{\frac{n\sum_{i=1}^n U_i^2 - \left(\sum_{i=1}^n U_i\right)^2}{n^2}}
46+
$$
47+
48+
## Comprehensive Development Index
49+
50+
The overall development level is defined as:
51+
52+
$$
53+
T = \sum_{i=1}^{n} \alpha_i U_i
54+
$$
55+
56+
where $\alpha_i$ are weights with $\sum \alpha_i = 1$.
57+
58+
## Coordination Degree
59+
60+
The coordination degree $D$ integrates interaction $C$ and development $T$:
61+
62+
$$
63+
D = \sqrt{C \times T}
64+
$$
65+
66+
where
67+
- $C$ measures coupling degree
68+
- $T$ measures development level
69+
- $D$ reflects coordinated development
70+
71+
## Metacoupling Perspective
72+
73+
The CCD framework can be extended under the $\text{metacoupling framework}^{[3,4]}$, distinguishing:
74+
75+
- **Intracoupling**
76+
- **Pericoupling**
77+
- **Telecoupling**
78+
79+
This enables cross-scale analysis of coupling.
80+
81+
# Example Cases
82+
83+
## Install necessary packages and load data
84+
85+
86+
``` r
87+
install.packages(c("sdsfun", "coupling", "tidyr", "dplyr", "ggplot2"), dep = TRUE)
88+
```
89+
90+
The `gzma` dataset represents the *Data of Social Space Quality in Guangzhou Metropolitan Areas of China (2010)*. It contains multiple indicators describing urban social space conditions. In particular, four key variables correspond to subsystem scores, including population stability (`PS_Score`), educational level (`EL_Score`), occupational hierarchy (`OH_Score`), and income level (`IL_Score `).
91+
92+
Load the `gzma` dataset from the `sdsfun` package:
93+
94+
95+
``` r
96+
gzma = sf::read_sf(system.file('extdata/gzma.gpkg',package = 'sdsfun'))
97+
gzma
98+
## Simple feature collection with 118 features and 4 fields
99+
## Geometry type: POLYGON
100+
## Dimension: XY
101+
## Bounding box: xmin: 113.1485 ymin: 22.94659 xmax: 113.5628 ymax: 23.33026
102+
## Geodetic CRS: WGS 84
103+
## # A tibble: 118 × 5
104+
## PS_Score EL_Score OH_Score IL_Score geom
105+
## <dbl> <dbl> <dbl> <dbl> <POLYGON [°]>
106+
## 1 7.21 4.64 4.75 2.64 ((113.2797 23.13359, 113.2715 23.13413, 113.2682 23.13371, …
107+
## 2 3.55 3.81 3.91 4.06 ((113.2519 23.15353, 113.2497 23.15545, 113.254 23.15774, 1…
108+
## 3 7.94 4.69 4.86 3.31 ((113.2815 23.12902, 113.2749 23.12969, 113.2732 23.12523, …
109+
## 4 8.22 4.93 4.92 3.74 ((113.3098 23.12458, 113.3046 23.12448, 113.3026 23.12642, …
110+
## 5 7.84 4.74 4.98 4.69 ((113.3099 23.11566, 113.3087 23.11542, 113.2957 23.11531, …
111+
## 6 8.12 5.13 4.98 3.92 ((113.2864 23.13354, 113.2863 23.135, 113.2884 23.1375, 113…
112+
## 7 8.30 5.18 4.87 3.77 ((113.2797 23.13359, 113.2799 23.13956, 113.274 23.14182, 1…
113+
## 8 5.14 4.43 4.41 4.13 ((113.3013 23.16168, 113.2985 23.16208, 113.296 23.16051, 1…
114+
## 9 5.92 4.18 4.37 2.29 ((113.2631 23.12832, 113.2586 23.12813, 113.2592 23.12228, …
115+
## 10 6.99 4.32 4.24 2.72 ((113.2747 23.12164, 113.2727 23.12362, 113.2732 23.12523, …
116+
## # ℹ 108 more rows
117+
```
118+
119+
Normalize the `*_Score` columns:
120+
121+
122+
``` r
123+
dt = apply(sf::st_drop_geometry(gzma), 2,
124+
\(.x) (.x - min(.x)) / (max(.x) - min(.x)))
125+
head(dt)
126+
## PS_Score EL_Score OH_Score IL_Score
127+
## 1 0.8179733 0.3246648 0.6590316 0.1308531
128+
## 2 0.3020233 0.1318888 0.4046987 0.5173794
129+
## 3 0.9209903 0.3353516 0.6921477 0.3141320
130+
## 4 0.9604095 0.3914758 0.7099999 0.4316421
131+
## 5 0.9061589 0.3473603 0.7297774 0.6909494
132+
## 6 0.9456379 0.4391423 0.7304117 0.4792905
133+
```
134+
135+
## Analysis of coupling coordination degree
136+
137+
138+
``` r
139+
ccd_standard = coupling::ccd(dt)
140+
head(ccd_standard)
141+
## C D
142+
## 1 0.8051958 0.6237105
143+
## 2 0.8914577 0.5497290
144+
## 3 0.8999423 0.7134825
145+
## 4 0.9346128 0.7632959
146+
## 5 0.9440912 0.7944703
147+
## 6 0.9519923 0.7858001
148+
```
149+
150+
151+
``` r
152+
ccd_wang = coupling::ccd(dt, method = "wang")
153+
head(ccd_wang)
154+
## C D
155+
## 1 0.4722274 0.4776480
156+
## 2 0.6211236 0.4588675
157+
## 3 0.5375842 0.5514412
158+
## 4 0.5861986 0.6045044
159+
## 5 0.6640321 0.6662930
160+
## 6 0.6319211 0.6402164
161+
```
162+
163+
164+
``` r
165+
ccd_fan = coupling::ccd(dt, method = "fan")
166+
head(ccd_fan)
167+
## C D
168+
## 1 0.4593785 0.4711049
169+
## 2 0.7164548 0.4928249
170+
## 3 0.4915051 0.5272784
171+
## 4 0.5399620 0.5801746
172+
## 5 0.5951898 0.6308098
173+
## 6 0.5907777 0.6190239
174+
```
175+
176+
177+
``` r
178+
ccd_df = do.call(cbind, list(ccd_standard, ccd_wang, ccd_fan))
179+
names(ccd_df) = paste0(rep(c("standard", "wang", "fan"), each = 2),
180+
"_", rep(c("C", "D"), times = 3))
181+
fig1 = ccd_df |>
182+
sf::st_set_geometry(sf::st_geometry(gzma)) |>
183+
tidyr::pivot_longer(-geometry, names_to = "var", values_to = "val") |>
184+
dplyr::mutate(var = factor(var, levels = names(ccd_df))) |>
185+
ggplot2::ggplot() +
186+
ggplot2::geom_sf(ggplot2::aes(fill = val), color = "grey40", lwd = 0.15) +
187+
ggplot2::scale_fill_gradientn(
188+
name = "degree",
189+
colors = c("#ffffcc", "#d9f0a3", "#addd8e",
190+
"#78c679", "#31a354", "#006837")
191+
) +
192+
ggplot2::facet_wrap(~var, ncol = 2) +
193+
ggplot2::theme_bw(base_family = "serif") +
194+
ggplot2::theme(
195+
panel.grid = ggplot2::element_blank(),
196+
axis.text = ggplot2::element_blank(),
197+
axis.ticks = ggplot2::element_blank(),
198+
strip.text = ggplot2::element_text(face = "bold", size = 15),
199+
legend.title = ggplot2::element_text(size = 16.5),
200+
legend.text = ggplot2::element_text(size = 15)
201+
)
202+
fig1
203+
```
204+
205+
![**Figure 1**. Spatial distribution of CCD components across three estimation methods. Panels display component C and component D derived from the standard, Wang, and Fan methods, respectively.](../man/figures/ccd/fig_ccd-1.png)
206+
207+
## A Meta-Coupling Analysis
208+
209+
Due to data limitations, here we focus on **peri-coupling** based on a Queen contiguity structure. Pericoupling among neighboring units are further weighted using an inverse distance scheme. The calculation of the coupling coordination degree adopts the formulation proposed by $\text{wang et al}^{[1]}$.
210+
211+
212+
``` r
213+
nb = sdsfun::spdep_nb(gzma)
214+
swm_peri = sdsfun::inverse_distance_swm(gzma)
215+
for (i in seq_len(nrow(gzma))) {
216+
swm_peri[i, seq_len(nrow(gzma))[-nb[[i]]]] = 0
217+
}
218+
swm_peri = apply(swm_peri, 1, \(.x) .x / sum(.x))
219+
220+
mc_wang = coupling::metacoupling(dt, swm_peri = swm_peri, method = "wang")
221+
head(mc_wang)
222+
## Intra_C Intra_D Peri_C Peri_D Tele_C Tele_D
223+
## 1 0.4722274 0.4776480 0.7414392 0.7507625 0 0
224+
## 2 0.6211236 0.4588675 0.6712215 0.5061883 0 0
225+
## 3 0.5375842 0.5514412 0.4539894 0.4644758 0 0
226+
## 4 0.5861986 0.6045044 0.6692548 0.6808108 0 0
227+
## 5 0.6640321 0.6662930 0.6880871 0.6870927 0 0
228+
## 6 0.6319211 0.6402164 0.6064480 0.6032699 0 0
229+
```
230+
231+
232+
``` r
233+
fig2 = mc_wang |>
234+
dplyr::select(dplyr::all_of(c("Intra_C", "Intra_D", "Peri_C", "Peri_D"))) |>
235+
sf::st_set_geometry(sf::st_geometry(gzma)) |>
236+
tidyr::pivot_longer(-geometry, names_to = "var", values_to = "val") |>
237+
dplyr::mutate(var = factor(var,
238+
levels = c("Intra_C", "Intra_D", "Peri_C", "Peri_D"))) |>
239+
ggplot2::ggplot() +
240+
ggplot2::geom_sf(ggplot2::aes(fill = val), color = "grey40", lwd = 0.15) +
241+
ggplot2::scale_fill_gradientn(
242+
name = "degree",
243+
colors = c("#ffffcc", "#d9f0a3", "#addd8e",
244+
"#78c679", "#31a354", "#006837")
245+
) +
246+
ggplot2::facet_wrap(~var, ncol = 2) +
247+
ggplot2::theme_bw(base_family = "serif") +
248+
ggplot2::theme(
249+
panel.grid = ggplot2::element_blank(),
250+
axis.text = ggplot2::element_blank(),
251+
axis.ticks = ggplot2::element_blank(),
252+
strip.text = ggplot2::element_text(face = "bold", size = 15),
253+
legend.title = ggplot2::element_text(size = 16.5),
254+
legend.text = ggplot2::element_text(size = 15)
255+
)
256+
fig2
257+
```
258+
259+
![**Figure 2**. Spatial distribution of intra- and pericoupling CCD components based on the Wang formulation. Panels display coupling degree (C) and coordination degree (D) for intra- and pericoupling, respectively.](../man/figures/ccd/fig_metacoupling-1.png)
260+
261+
## References
262+
263+
[1] Wang, S., Kong, W., Ren, L. and ZHI, D., 2021. Research on misuses and modification of coupling coordination degree model in China. Journal of Natural Resources, 36, 793-810. https://doi.org/10.31497/zrzyxb.20210319
264+
265+
[2] Fan, D., Ke, H. and Cao, R., 2024. Modification and improvement of coupling coordination degree model. Stat. Decis, 40, 41-46. https://doi.org/10.13546/j.cnki.tjyjc.2024.22.007
266+
267+
[3] Tang, P., Huang, J., Zhou, H., Fang, C., Zhan, Y., Huang, W., 2021. Local and telecoupling coordination degree model of urbanization and the eco-environment based on RS and GIS: A case study in the Wuhan urban agglomeration. Sustainable Cities and Society 75, 103405. https://doi.org/10.1016/j.scs.2021.103405
268+
269+
[4] Li, Y., Jia, N., Zheng, L., Yin, C., Chen, K., Sun, N., Jiang, A., Wang, M., Chen, R., Zhou, Z., 2026. A meta-coupling analysis between three-dimensional urbanization and ecosystem services in China’s urban agglomerations. Communications Earth & Environment 7. https://doi.org/10.1038/s43247-025-03047-w

0 commit comments

Comments
 (0)