Learn R Programming

HMMCont (version 1.0)

logreturns: Calculating Log-returns

Description

Simple function that calculates log-returns from prices time series.

Usage

logreturns(x)

Arguments

x
Vector of prices or an index values (class "numeric").

Value

Vector of log-returns (class "numeric").

See Also

Functions: hmmsetcont, baumwelchcont, viterbicont, and statesDistributionsPlot.

Examples

Run this code

Returns<-logreturns(Prices)
par(mfrow=c(2,1))
plot(Prices, type="l") 
plot(Returns, type="l")

Run the code above in your browser using DataLab