FIN 480: Fundamental Model of USD/GBP

The code below will estimate the simple fundamental model of the US dollar/ UK pound exchange rate. The code will then calculate the distribution of these returns both by simulation and analytically.

library(quantmod)

## EXUSUK: US/UK exchange rate GBRCPIALLMINMEI: UK monthly CPI NSA
## GBRPROINDMISMEI: UK monthly industrial production SA CPIAUCSL: US CPI NSA
## INDPRO: US Industricl Production: SA

getSymbols(c("EXUSUK", "GBRCPIALLMINMEI", "GBRPROINDMISMEI", "CPIAUCSL", "INDPRO"), 
    src = "FRED")
## [1] "EXUSUK"          "GBRCPIALLMINMEI" "GBRPROINDMISMEI" "CPIAUCSL"       
## [5] "INDPRO"

date.ukcpi <- index(GBRCPIALLMINMEI)
ukcpi <- as.numeric(GBRCPIALLMINMEI[, 1])
ukcpi <- as.xts(ukcpi, order.by = date.ukcpi)

fx.r <- Delt(EXUSUK)[-1]
ukcpi.r <- Delt(ukcpi)[-1]
uscpi.r <- Delt(CPIAUCSL)[-1]
ukprod.r <- Delt(GBRPROINDMISMEI)[-1]
usprod.r <- Delt(INDPRO)[-1]

data <- merge(fx.r, ukcpi.r, uscpi.r, ukprod.r, usprod.r, join = "inner")
names(data) <- c("fx.r", "ukcpi.r", "uscpi.r", "ukprod.r", "usprod.r")

diff.cpi <- data$ukcpi.r - data$uscpi.r
diff.prod <- data$ukprod.r - data$usprod.r

reg1 <- lm(data$fx.r ~ diff.cpi + diff.prod)
reg2 <- lm(data$fx.r[-1] ~ diff.cpi[-length(diff.cpi)] + diff.prod[-length(diff.prod)])
summary(reg1)
## 
## Call:
## lm(formula = data$fx.r ~ diff.cpi + diff.prod)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.10510 -0.01380  0.00053  0.01473  0.10334 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.000178   0.001080   -0.16     0.87
## diff.cpi    -0.188252   0.175075   -1.08     0.28
## diff.prod    0.037894   0.070633    0.54     0.59
## 
## Residual standard error: 0.0239 on 512 degrees of freedom
## Multiple R-squared:  0.0027, Adjusted R-squared:  -0.00119 
## F-statistic: 0.694 on 2 and 512 DF,  p-value: 0.5
summary(reg2)
## 
## Call:
## lm(formula = data$fx.r[-1] ~ diff.cpi[-length(diff.cpi)] + diff.prod[-length(diff.prod)])
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.10434 -0.01401  0.00049  0.01503  0.10061 
## 
## Coefficients:
##                                Estimate Std. Error t value Pr(>|t|)
## (Intercept)                   -0.000405   0.001083   -0.37     0.71
## diff.cpi[-length(diff.cpi)]   -0.055130   0.175458   -0.31     0.75
## diff.prod[-length(diff.prod)] -0.001767   0.070795   -0.02     0.98
## 
## Residual standard error: 0.0239 on 511 degrees of freedom
## Multiple R-squared:  0.000196,   Adjusted R-squared:  -0.00372 
## F-statistic: 0.0502 on 2 and 511 DF,  p-value: 0.951

Simulated vs Analytic Distribution of USD/GBP Returns

## simulate distribution

cpi.rv <- rnorm(1e+07, mean(diff.cpi), sd(diff.cpi))
prod.rv <- rnorm(1e+07, mean(diff.prod), sd(diff.prod))

dist1 <- reg1$coef[1] + reg1$coef[2] * cpi.rv + reg1$coef[3] * prod.rv
mean.dist1.sim <- mean(dist1)
sd.dist1.sim <- sd(dist1) + summary(reg1)[6]$sigma

mean.dist1.a <- reg1$coef[1] + reg1$coef[2] * mean(cpi.rv) + reg1$coef[3] * 
    mean(prod.rv)
sd.dist1.a <- sqrt(reg1$coef[2]^2 * var(cpi.rv) + reg1$coef[3]^2 * var(prod.rv)) + 
    summary(reg1)[6]$sigma

Mean and Standard Deviation from Simulation:

mean.dist1.sim
## [1] -0.0004597
sd.dist1.sim
## [1] 0.02517

Analytically Calculated Mean and Standard Deviation:

mean.dist1.a
## (Intercept) 
##  -0.0004597
sd.dist1.a
## diff.cpi 
##  0.02517

Notice they are just about the same (more simulated random variabels will make it even closer). This points to the fact that simulation is only useful if you can't solve the problem analytically.

plot(density(rnorm(1e+07, mean.dist1.sim, sd.dist1.sim)), main = "Distribution of UDS/GBP Returns", 
    lwd = 3)
lines(density(rnorm(1e+07, mean.dist1.a, sd.dist1.a)), col = 3, lwd = 3, lty = 2)
legend("topleft", c("Simulation", "Analytic"), lty = c(1, 2), col = c(1, 3), 
    lwd = c(3, 3))

plot of chunk unnamed-chunk-6