fxreturns: Compute Exchange Rate Returns

Description Usage Arguments Details Value References See Also Examples

View source: R/fxreturns.R

Description

Compute a multivariate series of exchange rate returns (log-returns in percent) from a multivariate series of exchange rates.

Usage

1
2
fxreturns(x, other = c("USD", "JPY", "DUR", "GBP"), data = NULL,
  frequency = "weekly", start = NULL, end = NULL, na.action = na.locf, trim = FALSE)

Arguments

x

character with column name of selected target currency.

other

character vector with column names of further currencies (to be used as regressors).

data

a "zoo" time series with FX rates (with respect to a base currency). By default FXRatesCHF is used.

frequency

character specifying whether weekly or daily returns should be computed.

start

start time of the exchange rate series (before computing returns).

end

end time of the exchange rate series.

na.action

function for handling NAs.

trim

logical or numeric. Should time points with extreme returns of the target currency be excluded? If set to TRUE, the quantiles c(0.01, 0.99) are used for trimming.

Details

fxreturns is a convenience function for selecting a smaller number of currencies from a large database of exchange rates (such as FXRatesCHF provided with the package), selecting a certain time window (if necessary), computing returns (weekly or daily), eliminating missing values and potentially trimming extreme returns (of the target currency).

Value

A "zoo" with the returns of the specified currencies.

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

fxlm, fxregimes, fxmonitor

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## 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"))
plot(cny)

Example output

Loading required package: zoo

Attaching package:zooThe following objects are masked frompackage:base:

    as.Date, as.Date.numeric

Loading required package: strucchange
Loading required package: sandwich

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