Technical Reference  ·  R Package Documentation

CDREGM — Feature Outline & Implementation Plan

Capital–Democracy–Rule-of-Law Economic Growth Model
R Package Econometrics Political Economy CRAN 9 Categories · 59 Functions

CDR Framework

CDR
Unbiased model — structural analysis
G = f(C, D, R)
R² = 74%
Jacobian Divergence ≈ 1.8% growth; Curl ≈ 9.6% ROI
CDRN
Biased — pedagogical 2SLS
G = f(C, D, R, N)
R² = 83%
Uses latitude L as IV for C; recovers unbiased CDR
CDRNL
Biased — optimal GDP predictor
G = f(C, D, R, N, L)
R² = 90%
Highest predictive accuracy; not for structural interpretation

The unbiased CDR model is used for structural interpretation. Its Jacobian (matrix of partial derivatives of G w.r.t. C, D, R) behaves as a vector field: the Divergence of that Jacobian yields ~1.8% annual GDP growth — matching the long-run empirical rate for developed economies (USA, UK, Germany) — and the Curl yields ~9.6% return on investment, consistent with the empirical range of US corporate profit expectations (6–10%). These quantities were published as a discovery that vector field structure (Jacobian, Divergence, Curl) exists in the economy.

CDRN and CDRNL are better predictors but biased; CDRN's main role is pedagogical — illustrating how instrumental-variable estimation (latitude as IV) recovers the unbiased model. Key results: entrepreneurship drives ~85% of GDP (2SLS), CDR explains 13× more than natural resources alone.

Cat. 1

Core Modeling — Foundation

IDFunctionDescription
F-01 cdr_standardize() Min-max normalization to [0,1] using 79-country sample bounds; prerequisite for all models
F-02 cdr_ols() Full OLS with interaction term C·D·R, partial R² per component, CDR index vector in result
F-03 cdr_2sls() Two-stage least squares using latitude as IV for C; returns entrepreneurship fraction (~85%) vs. capital stock (~15%)
F-04 cdr_index() Scalar CDR composite index = CDRs (additive) + CDRp (democratic friction); ranked data frame output
F-05 cdr_predict() Accepts raw or standardized inputs; internally converts raw → per-unit → [0,1] standardized before applying model coefficients, then returns predicted GDP in original dollar units
F-06a cdr_vector_field_cdrn() Constructs Jacobian of G w.r.t. (C, D, R) for the CDRN model (R²=83%); computes Divergence (endogenous growth rate) and Curl (return on investment); returns estimates and CIs
F-06b cdr_vector_field_cdrnl() Same Jacobian → Divergence → Curl derivation for the CDRNL model (R²=90%); returns estimates and CIs
F-07 cdr_max_growth() Upper-bound GDP growth predicted by the OLS model when C, D, R are all set to their standardized maximum (1.0); returns point estimate and CI from cdr_predict()
F-08 cdr_elasticity() Point elasticity of G w.r.t. entrepreneurship capital Ĉ at country-level (C, D, R, f)
Cat. 2

Modeling Extensions

IDFunctionDescription
F-09 cdr_panel() Fixed/random-effects panel model on indicators; Hausman test; cluster-robust SEs
F-10 cdr_gmm() Arellano-Bond dynamic GMM with lagged GDP; contrasts CDR with Solow-style log-linear specification (note: log-linearizing CDR variables reduces R² to 36%, and the Solow aggregate model is theoretically disputed — see conservation-of-capital proof)
F-11 cdr_quantile() Quantile regression at τ = 0.1/0.25/0.5/0.75/0.9; reveals heterogeneous CDR effects across GDP distribution
F-12 cdr_spatial() Spatial lag/error model via spdep; tests institutional contagion and neighborhood spillovers
F-13 cdr_bayes() Bayesian CDR regression with informative priors from published OLS; posterior distributions via rstanarm
F-14 cdr_bootstrap() Non-parametric bootstrap CIs for all coefficients and derived quantities (CDR index, growth rate)
F-15 cdr_robustness() Systematic robustness grid: alternate democracy/corruption sources, sample subsets (drop oil states, OECD only)
F-16 cdr_structural_break() Chow + Bai-Perron tests for coefficient stability across years; formalizes time-invariance claim
F-17 cdr_lasso_comparison() LASSO/Ridge CDR via glmnet; coefficient path plot contrasting data-driven vs. theory-specified selection
Cat. 3

Data Infrastructure

IDFunctionDescription
F-18 cdr_build_panel() Merges indicators + countries on ISO2; computes standardized C, D, R, N, L; adds C·D·R column
F-19 cdr_update_data() Orchestrates full dataset refresh from World Bank, V-Dem; writes updated .rda files
F-20 cdr_data_quality() Reports % missing per variable × year; flags countries/years with missing capitalization
F-21 cdr_add_country() Appends new country with live indicators; warns if outside 79-country sample bounds (extrapolation risk)
F-22 cdr_historical_panel() Fetches 2021–present annual data for all 79 countries; cached locally; reproduces time-invariance analysis
F-23 cdr_merge_external() Joins any external country dataset to CDR panel by ISO2, with fuzzy name matching via countrycode
F-24 cdr_iso_lookup() Accepts any country name format (ISO2/3, UN numeric, full name) → canonical ISO2; wraps countrycode
Cat. 4

Visualization

IDFunctionDescription
V-01 cdr_plot_scatter() G vs. any CDR variable; country flags via ggflags; fitted line; labeled outliers
V-02 cdr_plot_3d() Interactive 3D C × D × R bubble plot; GDP as bubble size; color by region; via plotly
V-03 cdr_plot_map() Choropleth world map colored by CDR index or component; hover tooltips; leaflet or ggplot2+sf
V-04 cdr_plot_animated() gganimate time series: countries moving in CDR space 1995–present; bubble size = GDP; produces GIF/HTML
V-05 cdr_plot_coefficient_path() CDR coefficients + 95% CIs plotted by year; visual proof of time-invariance
V-06 cdr_plot_decomposition() Stacked bar per country: C/D/R contributions + C·D·R friction + N; sorted by GDP
V-07 cdr_plot_quadrant() C vs. D, C vs. R, D vs. R political quadrant plots; flags at coordinates; GDP as bubble size
V-08 cdr_plot_frontier() "CDR efficiency frontier": countries achieving highest GDP for their CDR index (convex hull)
V-09 cdr_plot_residuals() Model diagnostic panel: residuals vs. fitted, Q-Q, scale-location, Cook's D; country labels on leverage points
V-10 cdr_plot_sensitivity() Spider/radar: predicted GDP as each of C, D, R varies from current to 1.0, others fixed
V-11 cdr_plot_convergence() Beta-convergence: initial log-GDP vs. growth rate; CDR quintile as color
V-12 cdr_plot_natural_resources() N vs. G scatter; color by CDR quintile; annotates 13:1 CDR:N explanatory ratio
V-13 cdr_plot_latitude() G vs. latitude; CDR quintile color overlay; highlights IV validity for 2SLS
V-14 cdr_plot_population() CDR index vs. population (log scale); bubble = GDP; flags; highlights China/India as outliers
Cat. 5

Policy Analysis Tools

IDFunctionDescription
P-01 cdr_simulate() Counterfactual: "what if country X raises D by 0.1?" → predicted GDP delta + CI; multiple scenarios
P-02 cdr_growth_gap() Gap from frontier (CDR = 1) decomposed into C, D, R, friction contributions; ranked policy priority table
P-03 cdr_growth_accounting() Shapley-value decomposition of ΔG between two years into ΔC, ΔD, ΔR, Δ(C·D·R), ΔN
P-04 cdr_immigration_impact() GDP impact of n immigrants from origin to destination country using Ridley immigration derivation
P-05 cdr_optimal_reinvestment() Country-specific optimal reinvestment fraction f; compares to global ~21%; trade-off curve
P-06 cdr_democratic_friction() Quantifies −1.21·C·D·R in $/capita and % of GDP; explains why the negative coefficient isn't anti-democracy
P-07 cdr_reform_path() Minimum-cost CDR reform trajectory to reach a target GDP; gradient-descent on CDR surface
P-08 cdr_marginal_returns() ∂G/∂C, ∂G/∂D, ∂G/∂R at current country values; "bang per reform dollar" ranking
Cat. 6

Comparative and Regional Analytics

IDFunctionDescription
C-01 cdr_peer_group() k-nearest countries in CDR space (Euclidean/Mahalanobis); peer comparison table
C-02 cdr_regional_summary() Population-weighted CDR aggregates by World Bank region × year; IQR range
C-03 cdr_benchmarking() Country vs. income-group peers (LIC/LMIC/UMIC/HIC) and geographic region; SD above/below each reference
C-04 cdr_convergence_clubs() Phillips-Sul log-t test for convergence clubs; tests CDR-theory polarization prediction
C-05 cdr_income_mobility() GDP quintile transition matrices cross-tabulated by CDR quintile; over panel years
Cat. 7

Educational and Interactive Tools

IDFunctionDescription
E-01 cdr_explorer() Shiny app: 6 panels — CDR scatter, 3D bubble, world map, country profile, counterfactual sliders, animation
E-02 cdr_teach_standardization() Step-by-step console tutorial: shows each standardization formula applied to one country's raw data
E-03 cdr_explain_model() Plain-English model interpretation: coefficient meanings, friction explanation, entrepreneurship share
E-04 cdr_diagnostic_suite() One-call OLS diagnostics: Breusch-Pagan, Durbin-Watson, Shapiro-Wilk, VIF, Cook's D; pass/warn/fail
Cat. 8

Report Generation

IDFunctionDescription
R-01 cdr_country_report() Self-contained HTML/PDF country profile: CDR scores, peer comparison, growth gap, policy table, flag
R-02 cdr_comparison_table() Formatted gt/kableExtra table for a list of countries; LaTeX/Word/HTML export
R-03 cdr_executive_summary() Two-page policy brief (PDF/HTML): model fit, top/bottom performers, regional averages, named country analysis
R-04 cdr_replication_report() Runs full pipeline on 2014 data; compares reproduced vs. published coefficients; "replication passed" badge
Cat. 9

Package Integration

IDFeatureDescription
I-01 tidy.cdr_model() / glance.cdr_model() broom methods for CDR model objects → modelsummary and stargazer compatibility
I-02 geom_cdr_flag() ggplot2 geom placing country flags at arbitrary (x, y) coordinates using bundled PNGs
I-03 cdr_sf() Returns SF data frame merging CDR data with Natural Earth geometries; ready for geom_sf()
I-04 cdr_democracy_source argument All models accept democracy = c("vdem", "freedomhouse", "polity5") for robustness across sources
I-05 WDI backend option get_country_indicators(backend = c("wbstats", "WDI")) for compatibility in restricted environments
§

Current Datasets

indicators
All economic indicators panel — single source for modeling; missing values are NA
iso2c year gdp capitalization democracy corruption population
countries
Static country metadata — join to indicators on iso2c = code
code country latitude natural_resources natural_resources_year
§

Implementation Priority

Tier 1
Consolidation Done
  • CDR dataset removed
  • indicators → 7 columns
  • No back-filling
Tier 2
Core Modeling
  • cdr_standardize
  • cdr_ols
  • cdr_2sls
  • cdr_index
  • cdr_build_panel
Tier 3
Research Core
  • cdr_endogenous_rate
  • cdr_elasticity
  • cdr_bootstrap
  • cdr_robustness
  • cdr_panel
  • cdr_simulate
  • cdr_growth_gap
  • cdr_plot_3d
  • cdr_plot_coefficient_path
Tier 4
Policy & Dissemination
  • cdr_explorer (Shiny)
  • cdr_country_report
  • cdr_plot_map
  • cdr_plot_animated
  • cdr_democratic_friction
  • cdr_reform_path
  • cdr_peer_group
Tier 5
Advanced Econometrics
  • cdr_spatial
  • cdr_bayes
  • cdr_gmm
  • cdr_quantile
  • cdr_structural_break
  • cdr_convergence_clubs