Last data update: 2014.03.03

R: Convert price series to log-return series
TimeSeriesLogReturnR Documentation

Convert price series to log-return series

Description

Convert daily price series to log-return series by a specified time interval

Usage

TimeSeriesLogReturn(pr, days)

Arguments

pr

Array of daily prices

days

Time interval, typically 1 for one day

Value

Array of log-return series

Examples

  pr <- c( 100.0, 102.0, 106.0, 105.0 )
  logr <- TimeSeriesLogReturn(pr,1)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(LIHNPSD)
Loading required package: sn
Loading required package: stats4

Attaching package: 'sn'

The following object is masked from 'package:stats':

    sd

Loading required package: moments
Loading required package: BB
Loading required package: Bolstad2
Loading required package: optimx
Loading required package: Rmpfr
Loading required package: gmp

Attaching package: 'gmp'

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

    %*%, apply, crossprod, matrix, tcrossprod

C code of R package 'Rmpfr': GMP using 64 bits per limb


Attaching package: 'Rmpfr'

The following object is masked from 'package:sn':

    zeta

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

    dbinom, dnorm, dpois, pnorm

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

    cbind, pmax, pmin, rbind


Attaching package: 'LIHNPSD'

The following object is masked from 'package:stats':

    density

> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/LIHNPSD/TimeSeriesLogReturn.Rd_%03d_medium.png", width=480, height=480)
> ### Name: TimeSeriesLogReturn
> ### Title: Convert price series to log-return series
> ### Aliases: TimeSeriesLogReturn
> 
> ### ** Examples
> 
>   pr <- c( 100.0, 102.0, 106.0, 105.0 )
>   logr <- TimeSeriesLogReturn(pr,1)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>