fxlm: Exchange Rate Regression

Description Usage Arguments Details Value References See Also Examples

View source: R/fxlm.R

Description

Interface to lm for fitting exchange rate regression models (Frankel-Wei models).

Usage

1

Arguments

formula

a "formula" describing the linear model to be fit. For details see below.

data

a "zoo" time series.

...

arguments passed to lm.

Details

fxlm is a function for fitting exchange rate regression models also known as Frankel-Wei models. It is a simple convenience interface to lm: data is assumed to be a "zoo" series in which, by default, the first column is the dependent variable. If formula is omitted, the first column is regressed on the remaining columns in data. The main difference compared to plain lm models is that the error variance is reported as a full parameter (estimated by maximum likelihood) in the coef method and the estfun method (but currently not in the vcov method). Furthermore, the index (also known as the time stamps) of the underlying data set can be extracted by the time/index method.

Value

An object of class "fxlm" inheriting from "lm".

References

Shah A., Zeileis A., Patnaik I. (2005), What is the New Chinese Currency Regime?, Report 23, Department of Statistics and Mathematics, Wirtschaftsuniversitaet Wien, Research Report Series, November 2005. http://epub.wu.ac.at.

Zeileis A., Shah A., Patnaik I. (2010), Testing, Monitoring, and Dating Structural Changes in Exchange Rate Regimes, Computational Statistics and Data Analysis, 54(6), 1696–1706. http://dx.doi.org/10.1016/j.csda.2009.12.005.

See Also

lm, fxregimes

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
## load package and data
library("fxregime")
data("FXRatesCHF", package = "fxregime")

## compute returns for CNY (and explanatory currencies)
## for one year after abolishing fixed USD regime
cny <- fxreturns("CNY", frequency = "daily",
  start = as.Date("2005-07-25"), end = as.Date("2006-07-24"),
  other = c("USD", "JPY", "EUR", "GBP"))

## estimate full-sample exchange rate regression
fm <- fxlm(CNY ~ USD + JPY + EUR + GBP, data = cny)
coef(fm)
summary(fm)

## test parameter stability (with double max test)
scus <- gefp(fm, fit = NULL)
plot(scus, aggregate = FALSE)
## which shows a clear increase in the variance in March 2006

## alternative tests: Andrews' supLM ...
plot(scus, functional = supLM(0.1))
## ... or Nyblom-Hansen test (Cramer-von Mises type test)
plot(scus, functional = meanL2BB)

Example output

Loading required package: zoo

Attaching package: 'zoo'

The following objects are masked from 'package:base':

    as.Date, as.Date.numeric

Loading required package: strucchange
Loading required package: sandwich
 (Intercept)          USD          JPY          EUR          GBP   (Variance) 
-0.006582966  1.001249768  0.007730373 -0.009495698 -0.011369304  0.002013117 

Call:
fxlm(formula = CNY ~ USD + JPY + EUR + GBP, data = cny)

Residuals:
      Min        1Q    Median        3Q       Max 
-0.198939 -0.019109  0.002093  0.020506  0.172885 

Coefficients:
             Estimate Std. Error t value Pr(>|t|)    
(Intercept) -0.006583   0.002880  -2.286   0.0231 *  
USD          1.001250   0.006603 151.632   <2e-16 ***
JPY          0.007730   0.006839   1.130   0.2594    
EUR         -0.009496   0.018986  -0.500   0.6174    
GBP         -0.011369   0.011122  -1.022   0.3077    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.04532 on 245 degrees of freedom
Multiple R-squared:  0.9945,	Adjusted R-squared:  0.9944 
F-statistic: 1.11e+04 on 4 and 245 DF,  p-value: < 2.2e-16

fxregime documentation built on May 2, 2020, 9:05 a.m.