EVOLUTION-MANAGER
Edit File: periodReturn.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Calculate Periodic Returns</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for periodReturn {quantmod}"><tr><td>periodReturn {quantmod}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2> Calculate Periodic Returns </h2> <h3>Description</h3> <p>Given a set of prices, return periodic returns. </p> <h3>Usage</h3> <pre> periodReturn(x, period='monthly', subset=NULL, type='arithmetic', leading=TRUE, ...) dailyReturn(x, subset=NULL, type='arithmetic', leading=TRUE, ...) weeklyReturn(x, subset=NULL, type='arithmetic', leading=TRUE, ...) monthlyReturn(x, subset=NULL, type='arithmetic', leading=TRUE, ...) quarterlyReturn(x, subset=NULL, type='arithmetic', leading=TRUE, ...) annualReturn(x, subset=NULL, type='arithmetic', leading=TRUE, ...) yearlyReturn(x, subset=NULL, type='arithmetic', leading=TRUE, ...) allReturns(x, subset=NULL, type='arithmetic', leading=TRUE) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p> object of state prices, or an OHLC type object </p> </td></tr> <tr valign="top"><td><code>period</code></td> <td> <p> character string indicating time period. Valid entries are ‘daily’, ‘weekly’, ‘monthly’, ‘quarterly’, ‘yearly’. All are accessible from wrapper functions described below. Defaults to monthly returns (same as monthlyReturn)</p> </td></tr> <tr valign="top"><td><code>subset</code></td> <td> <p> an xts/ISO8601 style subset string </p> </td></tr> <tr valign="top"><td><code>type</code></td> <td> <p> type of returns: arithmetic (discrete) or log (continuous) </p> </td></tr> <tr valign="top"><td><code>leading</code></td> <td> <p> should incomplete leading period returns be returned </p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p> passed along to to.period </p> </td></tr> </table> <h3>Details</h3> <p><code>periodReturn</code> is the underlying function for wrappers: </p> <ul> <li> <p><code>allReturns: </code> calculate all available return periods </p> </li> <li> <p><code>dailyReturn: </code> calculate daily returns </p> </li> <li> <p><code>weeklyReturn: </code> calculate weekly returns </p> </li> <li> <p><code>monthlyReturn: </code> calculate monthly returns </p> </li> <li> <p><code>quarterlyReturn: </code> calculate quarterly returns </p> </li> <li> <p><code>annualReturn: </code> calculate annual returns </p> </li></ul> <h3>Value</h3> <p>Returns object of the class that was originally passed in, with the possible exception of monthly and quarterly return indicies being changed to class <code>yearmon</code> and <code>yearqtr</code> where available. This can be overridden with the <code>indexAt</code> argument passed in the ... to the <code>to.period</code> function. </p> <p>By default, if <code>subset</code> is NULL, the full dataset will be used. </p> <h3>Note</h3> <p>Attempts are made to re-convert the resultant series to its original class, if supported by the xts package. At present, objects inheriting from the ‘ts’ class are returned as <code>xts</code> objects. This is to make the results more visually appealling and informative. All <code>xts</code> objects can be converted to class <code>ts</code> with <code>as.ts</code> if that is desirable. </p> <p>The first and final row of returned object will have the period return to last date, i.e. this week/month/quarter/year return to date even if the start/end is not the start/end of the period. Leading period calculations can be suppressed by setting <code>leading=FALSE</code>. </p> <h3>Author(s)</h3> <p> Jeffrey A. Ryan </p> <h3>See Also</h3> <p><code><a href="getSymbols.html">getSymbols</a></code></p> <h3>Examples</h3> <pre> ## Not run: getSymbols('QQQQ',src='yahoo') allReturns(QQQQ) # returns all periods periodReturn(QQQQ,period='yearly',subset='2003::') # returns years 2003 to present periodReturn(QQQQ,period='yearly',subset='2003') # returns year 2003 rm(QQQQ) ## End(Not run) </pre> <hr /><div style="text-align: center;">[Package <em>quantmod</em> version 0.4.20 <a href="00Index.html">Index</a>]</div> </body></html>