Do economists interpolate currency exchange rate data?

Do economists interpolate currency exchange rate data?

Manage alerts

Loading saved threads...

stats_noob · External communityPost link
External question — Economics Stack Exchange Author: stats_noob Original post: https://economics.stackexchange.com/questions/59743 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. I am wondering if in Economics, economists sometimes interpolate currency exchange rates. For example, using R, I tried to get historical data on Canada-US dollar exchange rates. Here is the R code: library(quantmod) library(ggplot2) library(xts) library(tidyverse) plot_exchange_rates <- function(start_date, end_date) { if (is.character(start_date)) start_date <- as.Date(start_date) if (is.character(end_date)) end_date <- as.Date(end_date) exchange_data <- getSymbols("CADUSD=X", from = start_date - 5, to = end_date + 5, auto.assign = FALSE) daily_rates <- Cl(exchange_data) df <- data.frame( date = index(daily_rates), rate = as.numeric(daily_rates) ) %>% filter(!is.na(rate)) %>% arrange(date) p <- ggplot(df, aes(x = date, y = rate)) + geom_line(color = "black", size = 0.5) + # Add the small points geom_point(color = "red", size = 0.8, alpha = 0.6) + theme_minimal() + labs( title = "CAD/USD Exchange Rate Over Time", subtitle = paste0("Period: ", format(start_date, "%B %d, %Y"), " to ", format(end_date, "%B %d, %Y"), "\nRed points: Actual rates | Black line: Linear interpolation"), x = "Date", y = "Exchange Rate (USD per CAD)" ) + scale_x_date( date_breaks = "3 months", date_labels = "%Y-%m", expand = expansion(mult = c(0.02, 0.02)) ) + theme( plot.title = element_text(size = 14, face = "bold"), plot.subtitle = element_text(size = 10), axis.text.x = element_text( angle = 0, hjust = 0.5, vjust = 0.5, margin = margin(t = 10) ), panel.grid.major = element_line(color = "gray90"), panel.grid.minor = element_blank(), plot.margin = margin(t = 20, r = 20, b = 30, l = 20) ) + scale_y_continuous( labels = scales::number_format(accuracy = 0.001), expand = expansion(mult = c(0.02, 0.02)) ) return(list( plot = p, data = df )) } result <- plot_exchange_rates("2019-01-05", "2024-01-05") print(result$plot) I also decided to interpolate missing values using linear interpolation: I am just wondering: is this an appropriate approach in economics? Thanks! I found an alternate source of data for this: https://www.bankofcanada.ca/rates/exchange/daily-exchange-rates-lookup/?lookupPage=lookup_daily_exchange_rates_2017.php&startRange=2017-01-01&series%5B%5D=FXUSDCAD&lookupPage=lookup_daily_exchange_rates_2017.php&startRange=2017-01-01&rangeType=range&rangeValue=&dFrom=2020-01-01&dTo=2025-01-01&submit_button=Submit See below: library(tidyverse) library(lubridate) exchange_data <- read_csv("https://www.bankofcanada.ca/valet/observations/FXUSDCAD/csv?start_date=2020-01-01&end_date=2025-01-01", skip = 8) ggplot(exchange_data, aes(x = date, y = FXUSDCAD)) + geom_line(color = "black", size = 0.5) + geom_point(color = "red", size = 0.8, alpha = 0.6) + theme_minimal() + labs( title = "USD to CAD Exchange Rate (2020-2025)", subtitle = "Data source: Bank of Canada\nRed points: Daily rates | Black line: Connecting trend", x = "Date", y = "Exchange Rate (CAD per 1 USD)" ) + scale_x_date( date_breaks = "6 months", date_labels = "%Y-%m", expand = expansion(mult = c(0.02, 0.02)) ) + scale_y_continuous( labels = scales::number_format(accuracy = 0.001), expand = expansion(mult = c(0.02, 0.02)) ) + theme( plot.title = element_text(size = 14, face = "bold"), plot.subtitle = element_text(size = 10), axis.text.x = element_text( angle = 0, hjust = 0.5, vjust = 0.5 ), panel.grid.major = element_line(color = "gray90"), panel.grid.minor = element_blank(), plot.margin = margin(t = 20, r = 20, b = 30, l = 20) )
Quote
Report
ss91 · External communityPost link
External answer — Economics Stack Exchange Author: ss91 Original post: https://economics.stackexchange.com/a/59747 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. I think it depends on the amount of missing data points. If you have a lot of missing values, well, interpolation will most certainly give you inaccurate results. In some cases, with only a few missing points, it is fine i guess. But, again using linear methods in a non-linear or random variables can lead to spurious results. Linear transformation of the variable is therefore recommended.
Quote
Report

Post Reply

Quoted from Forex.com.bd-Editorial External answer — Economics Stack Exchange Author: ss91 Source score (net votes, not local likes): 1 Original post: https://economics.stackexchange.com/a/59747 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. I think it depends on the amount of missing data points. If you have a lot of missing values, well, interpolation will most certainly give you inaccurate results. In some cases, with only a few missing points, it is fine i guess. But, again using linear methods in a non-linear or random variables can lead to spurious results. Linear transformation of the variable is therefore recommended.

Cancel quote

Checking account access…