Learn R Programming

fEGarch (version 1.0.1)

close_to_lreturn: Log-Return Calculation From Closing Prices

Description

Makes log-returns available from an input closing price series.

Usage

close_to_lreturn(close)

Value

Returns the log-return series following the input close. The output object has one observation less than close, but keeps potential time series formatting.

Arguments

close

a closing price series as a numeric vector or some time series object like "ts" or "zoo" ordered chronologically.

Details

Let \(P_t\), \(t=1^,\dots,n\), be an observed closing price series. The function returns $$r_t = \ln{P_t}-\ln{P_{t-1}}$$, t = 2,...,n.

Examples

Run this code
# Assume SP500 + 100 was a closing price series,
# which it is not
close <- SP500 + 100
close_to_lreturn(close)

Run the code above in your browser using DataLab