Description Usage Arguments Details Value
This function computes matrices of equity curves associated with each feature provided, according to predefined rules. A list of xts matrices is returned, with each list item defined as follows:
item $long calculates the equity curve in a long only mode
item $longshort calculates the equity curves in a long-short mode
1 | make_featurecurve(price, featuremat, offsets = NA, Nlags = 0)
|
price |
An xts matrix containing daily prices of the asset used to build the equity curves. Only the first column is used. |
featuremat |
A daily xts matrix containing the feature vectors. The equity curves returned by this function will map directly to this matrix, where each feature will have its associated equity curve calculated. |
offsets |
A list containing numeric offsets for the named features. The format is <feature name> = <offset>. If a feature is not named in that list, then its offset defaults to zero. This offset list is often used with an offset of one to offset features that are centered around one (such as ratios). This way, negative feature value can be used to represent going short or to cash when computing the equity curve. |
Nlags |
The number of periods (days), either positive or negative, by which each specified feature will be lagged. Vector recycling is performed if length(Nlags) < number of features. Default is zero, recycled so no feature is lagged. |
See Value below for details on how these equity curves are calculated. This function can be useful to explore how features related to actual returns. Lagging of features is specified by argument Nlags.
A list containing xts matrices is returned, organized as follows:
$long
An xts matrix containing the equity curves associated with each feature, computed daily, and long when the feature value is positive or zero, or in cash otherwise (without earning any interest). The normalized asset price equity curve is also included to enable an easy comparison.
$longshort
An xts matrix containing the equity curves associated with each feature, computed daily, and long when the feature value is positive or zero, or short otherwise. The normalized asset price equity curve is also included to enable an easy comparison.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.