factorem: Construct an asset pricing factor

Description Usage Arguments Value

Description

Given a reference dataset and a set of parameters, construct the desired asset pricing factor and returns its return and position time series by leg.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
factorem(
  name = "",
  data,
  update_frequency = "month",
  return_frequency = "day",
  price_variable = "PX_LAST",
  sort_variable = "PX_LAST",
  sort_levels = T,
  weighted = T,
  ranking_period = 1L,
  long_threshold = 0.5,
  short_threshold = 0.5
)

Arguments

name

a scalar character vector specifying the name to use for the factor.

data

a dataframe/tibble. Columns must include ticker, date, field and value.

update_frequency

a scalar character vector. Specifies the rebalancing frequency. Must be one of 'year', 'semester', 'quarter', 'month', 'week' or 'day'. Defaults to 'month'.

return_frequency

a scalar character vector. Specifies the frequency of the returns output. Must be one of 'year', 'semester', 'quarter', 'month', 'week' or 'day'. Defaults to 'day'.

price_variable

a scalar character vector. Specifies the name of the variable hosting asset prices. Must be found in the field columns of data.

sort_variable

a scalar character vector. Specifies the name of the variable to use for sorting. Must be found in the field columns of data.

sort_levels

a scalar logical vector. If TRUE, sort is done on sort_variable's levels, else on relative changes. Default: TRUE.

weighted

a scalar logical vector. If TRUE adjusts portoflio weights with respect to sorting variable, else equal weights are used. Defaults to FALSE.

ranking_period

a scalar integer vector. Specifies number of periods in term of update_frequency looking backward for averaging sort_variable. Default: 1 (sort on last observation).

long_threshold

a scalar numeric vector. Specifies the threshold for short positions. Default: 0.5.

short_threshold

a scalar numeric vector. Specifies the threshold for long positions. Default: 0.5.

Value

An S4 object of class AssetPricingFactor.


bautheac/factorem documentation built on June 7, 2021, 12:11 p.m.