### Install epuR Package Source: https://github.com/lingbing/epur/blob/master/README.md Provides instructions for installing the epuR package from CRAN and the development version from GitHub. ```r install.packages("epuR") ``` ```r # install.packages("devtools") devtools::install_github("Lingbing/epuR") ``` -------------------------------- ### Get Economic Policy Uncertainty (EPU) Data Source: https://github.com/lingbing/epur/blob/master/README.md Demonstrates how to use the get_EPU() function to retrieve Economic Policy Uncertainty data. The function returns an xts time series object, suitable for direct plotting or further manipulation. ```r library(epuR) ## get EPU data epu_data <- get_EPU() class(epu_data) plot(epu_data) plot(epu_data$Australia) ``` -------------------------------- ### Get World Uncertainty Index (WUI) Data with epuR Source: https://context7.com/lingbing/epur/llms.txt Downloads World Uncertainty Index (WUI) data from worlduncertaintyindex.com using the epuR package. This function supports various data types including global averages, regional breakdowns, trade uncertainty, and country-specific indices. Output is an xts object. Dependencies include epuR and dygraphs. ```r library(epuR) library(dygraphs) # Get overall global uncertainty (F1 - default) wui_global <- get_WUI(type = "F1") dygraph(wui_global) # Get global trade uncertainty (F2) wui_trade <- get_WUI(type = "F2") plot(wui_trade) # Get WUI by regions and income levels (T1) wui_regions <- get_WUI(type = "T1") dygraph(wui_regions) # Get WUI for 143 individual countries (T2) wui_countries <- get_WUI(type = "T2") # Get World Trade Uncertainty Index by country (T8) wtui <- get_WUI(type = "T8") # Plot specific country (China) dygraph(wtui$CHN) # Available types: # F1: Overall global uncertainty # F2: Global trade uncertainty # T1: WUI by region and income level # T2: WUI for 143 countries # T3: Word count of "uncertainty" in EIU reports ``` -------------------------------- ### Get Equity Market Volatility (EMV) Index Data with epuR Source: https://context7.com/lingbing/epur/llms.txt Downloads US Equity Market Volatility (EMV) index data from policyuncertainty.com using the epuR package. This function can return either the overall EMV tracker or all category-specific components. The output is an xts time series object. Dependencies include epuR and dygraphs. ```r library(epuR) library(dygraphs) # Get overall EMV tracker only emv_overall <- get_EMV(all = FALSE) plot(emv_overall) dygraph(emv_overall) # Get all EMV categories (default) emv_all <- get_EMV(all = TRUE) # Contains multiple volatility category columns names(emv_all) # Access specific categories from full data dygraph(emv_all$Overall.EMV.Tracker) ``` -------------------------------- ### Get Economic Policy Uncertainty (EPU) Index Data with epuR Source: https://context7.com/lingbing/epur/llms.txt Retrieves Economic Policy Uncertainty (EPU) index data from policyuncertainty.com for multiple countries and regions. The function returns an xts time series object, suitable for plotting and analysis. Dependencies include the epuR and dygraphs packages. ```r library(epuR) library(dygraphs) # Get EPU data for all regions all_epu <- get_EPU() class(all_epu) #> [1] "xts" "zoo" # Plot all regions plot(all_epu) # Get EPU for a specific country china_epu <- get_EPU(region = "China") plot(china_epu) # Interactive visualization with dygraphs dygraph(china_epu) # Access specific country from all data and remove NAs australia_epu <- na.omit(all_epu$Australia) dygraph(australia_epu) ``` -------------------------------- ### Get Financial Stress Indicator (FSI) Data with epuR Source: https://context7.com/lingbing/epur/llms.txt Retrieves Financial Stress Indicator (FSI) data at either monthly or quarterly frequency using the epuR package. The FSI measures financial market stress levels and is returned as an xts time series object. Dependencies include epuR and dygraphs. ```r library(epuR) library(dygraphs) # Get monthly FSI data (default) fsi_monthly <- get_FSI() # or explicitly: fsi_monthly <- get_FSI(freq = "monthly") plot(fsi_monthly) dygraph(fsi_monthly) # Get quarterly FSI data fsi_quarterly <- get_FSI(freq = "quarterly") plot(fsi_quarterly) dygraph(fsi_quarterly) ``` -------------------------------- ### Get Trade Policy Uncertainty (TPU) Index Data with epuR Source: https://context7.com/lingbing/epur/llms.txt Retrieves Trade Policy Uncertainty (TPU) data for China, Japan, or the United States from epuR. The function can return specific indices for Japan, including EPU, FPU, MPU, TPU, and ERPU. Output is an xts object. Dependencies include epuR and dygraphs. ```r library(epuR) library(dygraphs) # Get China Trade Policy Uncertainty (default) china_tpu <- get_TPU() # or explicitly: china_tpu <- get_TPU(region = "China") plot(china_tpu) # Get US Trade Policy Uncertainty us_tpu <- get_TPU(region = "US") dygraph(us_tpu) # Get Japan data (includes multiple indices) japan_tpu <- get_TPU(region = "Japan") # Japan data contains: EPU, FPU, MPU, TPU, ERPU names(japan_tpu) #> [1] "EPU" "FPU" "MPU" "TPU" "ERPU" # Extract only Trade Policy Uncertainty from Japan dygraph(japan_tpu$TPU) ``` -------------------------------- ### get_WUI - World Uncertainty Index Source: https://context7.com/lingbing/epur/llms.txt Downloads World Uncertainty Index (WUI) data from worlduncertaintyindex.com. This function supports various data types including global averages, regional breakdowns, and country-specific indices. ```APIDOC ## get_WUI - World Uncertainty Index ### Description Downloads World Uncertainty Index (WUI) data from worlduncertaintyindex.com. The WUI measures economic uncertainty across 143 countries based on Economist Intelligence Unit country reports. Multiple data types are available covering global averages, regional breakdowns, trade uncertainty, and country-specific indices. ### Method GET ### Endpoint /api/wui ### Parameters #### Query Parameters - **type** (string) - Optional - Specifies the type of WUI data to retrieve. Available types include: - "F1": Overall global uncertainty - "F2": Global trade uncertainty - "T1": WUI by region and income level - "T2": WUI for 143 countries - "T8": World Trade Uncertainty Index by country Defaults to "F1". ### Request Example ```r library(epuR) # Get overall global uncertainty (F1 - default) wui_global <- get_WUI(type = "F1") # Get global trade uncertainty (F2) wui_trade <- get_WUI(type = "F2") # Get WUI by regions and income levels (T1) wui_regions <- get_WUI(type = "T1") # Get WUI for 143 individual countries (T2) wui_countries <- get_WUI(type = "T2") # Get World Trade Uncertainty Index by country (T8) wtui <- get_WUI(type = "T8") ``` ### Response #### Success Response (200) - **data** (xts) - An `xts` time series object containing the requested WUI data. The structure of the object depends on the `type` parameter (e.g., single column for global data, multiple columns for country-specific data). #### Response Example ```r # Example output structure for type = "F1" (xts object) # Global_WUI # 2000-01-01 10.5 # 2000-02-01 11.2 # ... # Example output structure for type = "T8" (xts object with country codes as columns) # CHN USA GBR ... # 2000-01-01 12.1 15.0 13.5 ... # 2000-02-01 12.5 15.3 13.8 ... # ... ``` ``` -------------------------------- ### Retrieve Financial Stress Indicator (FSI) Data Source: https://github.com/lingbing/epur/blob/master/README.md Illustrates fetching the Financial Stress Indicator (FSI) data using the get_FSI() function and visualizing it with dygraphs for interactive exploration. ```r fsi_data <- get_FSI() dygraph(fsi_data) ``` -------------------------------- ### Interactive Time Series Plotting with dygraphs Source: https://github.com/lingbing/epur/blob/master/README.md Shows how to use the dygraphs package to create interactive time series plots from the data retrieved by epuR functions. This allows for zooming, panning, and other interactive features. ```r library(dygraphs) dygraph(epu_data$China) ``` -------------------------------- ### get_EMV - Equity Market Volatility Index Source: https://context7.com/lingbing/epur/llms.txt Downloads US Equity Market Volatility (EMV) index data from policyuncertainty.com. This function can return either the overall EMV tracker or all category-specific components. ```APIDOC ## get_EMV - Equity Market Volatility Index ### Description Downloads US Equity Market Volatility (EMV) index data from policyuncertainty.com. The EMV tracker measures stock market volatility based on newspaper article frequency. Can return either the overall EMV tracker or all category-specific components that constitute the index. ### Method GET ### Endpoint /api/emv ### Parameters #### Query Parameters - **all** (boolean) - Optional - If TRUE, returns all category-specific components. If FALSE, returns only the overall EMV tracker. Defaults to TRUE. ### Request Example ```r library(epuR) # Get overall EMV tracker only emv_overall <- get_EMV(all = FALSE) # Get all EMV categories (default) emv_all <- get_EMV(all = TRUE) ``` ### Response #### Success Response (200) - **data** (xts) - An `xts` time series object containing EMV data. If `all = FALSE`, it contains a single column for the overall EMV tracker. If `all = TRUE`, it contains multiple columns for different EMV categories. #### Response Example ```r # Example output structure when all = FALSE (xts object) # Overall.EMV.Tracker # 2000-01-01 50.5 # 2000-02-01 52.1 # ... # Example output structure when all = TRUE (xts object with multiple columns) # Category1 Category2 ... Overall.EMV.Tracker # 2000-01-01 10.2 15.5 ... 50.5 # 2000-02-01 11.0 16.1 ... 52.1 # ... ``` ``` -------------------------------- ### Retrieve Geopolitical Risk Index (GPR) data Source: https://context7.com/lingbing/epur/llms.txt Downloads various GPR datasets including quarterly, historical, country-specific, and word frequency data. Useful for measuring geopolitical tensions based on newspaper analysis. ```r library(epuR) library(dygraphs) # Get quarterly Geopolitical Risk Index gpr_quarterly <- get_GPR(type = 1) dygraph(gpr_quarterly$GPR) ``` -------------------------------- ### Retrieve Oxford-Man Institute Realized Volatility Source: https://context7.com/lingbing/epur/llms.txt Downloads high-frequency realized volatility measures for global stock market indices. Note that this function may take 30-60 seconds due to the large dataset size. ```r library(epuR) library(dygraphs) # Get S&P 500 realized volatility spx_rv <- get_OMI(index = "SPX") dygraph(spx_rv) ``` -------------------------------- ### get_EPU - Economic Policy Uncertainty Index Source: https://context7.com/lingbing/epur/llms.txt Retrieves Economic Policy Uncertainty (EPU) index data from policyuncertainty.com. This function allows fetching data for all regions or a specific country, returning an xts time series object. ```APIDOC ## get_EPU - Economic Policy Uncertainty Index ### Description Retrieves Economic Policy Uncertainty (EPU) index data from policyuncertainty.com. The EPU index measures policy-related economic uncertainty based on newspaper coverage frequency. Data is available for multiple countries and regions, returned as an `xts` time series object with proper date formatting. ### Method GET ### Endpoint /api/epu ### Parameters #### Query Parameters - **region** (string) - Optional - The specific country or region to retrieve data for (e.g., "China", "US"). If not specified, data for all available regions is returned. ### Request Example ```r library(epuR) # Get EPU data for all regions all_epu <- get_EPU() # Get EPU for a specific country china_epu <- get_EPU(region = "China") ``` ### Response #### Success Response (200) - **data** (xts) - An `xts` time series object containing EPU data. If a specific region is requested, it contains data for that region. Otherwise, it contains data for all available regions. #### Response Example ```r # Example output structure (xts object) # Region1 Region2 ... # 2000-01-01 10.5 12.1 ... # 2000-02-01 11.2 13.0 ... # ... ``` ``` -------------------------------- ### get_FSI - Financial Stress Indicator Source: https://context7.com/lingbing/epur/llms.txt Retrieves Financial Stress Indicator (FSI) data at either monthly or quarterly frequency. The FSI measures financial market stress levels. ```APIDOC ## get_FSI - Financial Stress Indicator ### Description Retrieves Financial Stress Indicator (FSI) data at either monthly or quarterly frequency. The FSI measures financial market stress levels and is useful for analyzing periods of financial instability and market tensions. ### Method GET ### Endpoint /api/fsi ### Parameters #### Query Parameters - **freq** (string) - Optional - The frequency of the data to retrieve. Accepts "monthly" or "quarterly". Defaults to "monthly". ### Request Example ```r library(epuR) # Get monthly FSI data (default) fsi_monthly <- get_FSI() # Get quarterly FSI data fsi_quarterly <- get_FSI(freq = "quarterly") ``` ### Response #### Success Response (200) - **data** (xts) - An `xts` time series object containing FSI data at the specified frequency. #### Response Example ```r # Example output structure for monthly data (xts object) # FSI # 2000-01-01 0.85 # 2000-02-01 0.92 # ... # Example output structure for quarterly data (xts object) # FSI # 2000-Q1 0.88 # 2000-Q2 0.95 # ... ``` ``` -------------------------------- ### Retrieve Immigration Related Index (IRI) data Source: https://context7.com/lingbing/epur/llms.txt Fetches migrant-related policy uncertainty data for specific regions like the USA, UK, Germany, and France. Returns an xts object suitable for plotting with dygraphs. ```r library(epuR) library(dygraphs) # Get USA immigration-related indices usa_iri <- get_IRI(region = "USA") plot(usa_iri) dygraph(usa_iri) ``` -------------------------------- ### get_TPU - Trade Policy Uncertainty Index Source: https://context7.com/lingbing/epur/llms.txt Retrieves Trade Policy Uncertainty (TPU) data for China, Japan, or the United States. The function returns an xts time series object, and for Japan, it includes multiple related indices. ```APIDOC ## get_TPU - Trade Policy Uncertainty Index ### Description Retrieves Trade Policy Uncertainty (TPU) data for China, Japan, or the United States. The US TPU reflects newspaper articles discussing policy-related economic uncertainty with trade policy references. China TPU is constructed using Renmin Daily and Guangming Daily newspapers. Japan data includes additional indices: EPU, FPU, MPU, and ERPU. ### Method GET ### Endpoint /api/tpu ### Parameters #### Query Parameters - **region** (string) - Optional - The specific country to retrieve data for. Defaults to "China". Accepts "China", "US", or "Japan". ### Request Example ```r library(epuR) # Get China Trade Policy Uncertainty (default) china_tpu <- get_TPU() # Get US Trade Policy Uncertainty us_tpu <- get_TPU(region = "US") # Get Japan data (includes multiple indices) japan_tpu <- get_TPU(region = "Japan") ``` ### Response #### Success Response (200) - **data** (xts) - An `xts` time series object containing TPU data. For Japan, this object will contain multiple columns representing different indices (EPU, FPU, MPU, TPU, ERPU). #### Response Example ```r # Example output structure for China/US (xts object) # TPU # 2000-01-01 15.2 # 2000-02-01 16.0 # ... # Example output structure for Japan (xts object with multiple columns) # EPU FPU MPU TPU ERPU # 2000-01-01 10.1 5.2 6.3 15.2 7.1 # 2000-02-01 11.0 5.5 6.5 16.0 7.5 # ... ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.