# fxregimes

##### Dating Breaks Between Exchange Rate Regimes

Estimate changes/breaks between exchange rate regimes (based on exchange rate regression models).

- Keywords
- regression

##### Usage

`fxregimes(formula, data, …, hpc = c("none", "foreach"))`

##### Arguments

- formula
a

`"formula"`

describing the linear model to be fit (as in`fxlm`

.- data
a

`"zoo"`

time series.- …
further arguments passed to

`gbreakpoints`

(currently unexported, see below), most of the arguments are identical to the`formula`

method of`breakpoints`

- hpc
a character specifying the high performance computing support. Default is

`"none"`

, can be set to`"foreach"`

.

##### Details

`fxregimes`

segments an exchange rate regression (Frankel-Wei regression)
into different regimes. The breakpoints are chosen to maximize the likelihood of
a Gaussian regression (with regime-specific variances). The number of breakpoints
are selected according to information criteria (by default LWZ, but BIC is also
reported).

The computing engine behind `fxregime`

is `gbreakpoints`

that generalizes
various aspects about `breakpoints`

. Its interface
is not yet fixed, hence it is not exported in the namespace (and not documented).
Most arguments are similar to those of the `formula`

method of `breakpoints`

,
in particular the minimal segment size `h`

and the maximal number of breaks
`breaks`

. To select the default information criterion the new argument
`ic`

can be set either to `"LWZ"`

(the default) or `"BIC"`

.

A set of methods for useful generic functions is available, including `plot`

,
`print`

, `summary`

, `lines`

, `coef`

, `fitted`

, `residuals`

,
`breakfactor`

, `breakpoints`

, `breakdates`

, etc. Mostly, they behave
like their `"breakpoints"`

counterparts. Querying information about the
models on each segment is made particularly easy by providing a `refit`

method that returns a list of `fxlm`

objects.

Optional support for high performance computing is available, currently using
`foreach`

for the dynamic programming algorithm.
If `hpc = "foreach"`

is to be used, a parallel backend should be registered
before. See `foreach`

for more information.

##### Value

An object of class `"fxregimes"`

inheriting from `"gbreakpointsfull"`

,
`"gbreakpoints"`

, `"breakpointsfull"`

, `"breakpoints"`

.

##### References

Zeileis A., Kleiber C., Kr<e4>mer W., Hornik K. (2003), Testing and Dating of
Structural Changes in Practice, *Computational Statistics and Data Analysis*,
**44**, 109-123.

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

##### Examples

```
# NOT RUN {
## 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"))
## compute all segmented regression with minimal segment size of
## h = 20 and maximal number of breaks = 5.
reg <- fxregimes(CNY ~ USD + JPY + EUR + GBP,
data = cny, h = 20, breaks = 5, ic = "BIC")
summary(reg)
## minimum BIC is attained for 2-segment (1-break) model
plot(reg)
## two regimes
## 1: tight USD peg
## 2: slightly more relaxed USD peg
round(coef(reg), digits = 3)
sqrt(coef(reg)[, "(Variance)"])
## inspect two individual models by re-fitting
refit(reg)
# }
```

*Documentation reproduced from package fxregime, version 1.0-4, License: GPL-2 | GPL-3*