build_derived_factor: Build factors derived from existing time-series using...

Description Usage Arguments Details Value Examples

View source: R/build_derived_factor.R

Description

The function build_derived_factor retrieves time-series from existing csv-formatted source files and build factors with more extensive manipulations than simple linear combinations. The set of derived factors is governed by an internal registry object called derived_catalog. This general framework tightly controls the building process in two specific ways: (1) it prevents the unintended manufacturing of additional derived factors (2) it prevents material defects in the manufacturing of existing factors.

Usage

1
2
3
4
5
6
build_derived_factor(
  hdl,
  region,
  frequency,
  src_dir = "~/Desktop/UMich/Factor Warehouse/Uncompressed"
)

Arguments

hdl

A string representing the factor name. See details.

region

A string or vector of strings, indicating which asset to source. See details.

frequency

A string representing the source handle. See details.

src_dir

A string representing an existing path directory where the csv-formatted files reside. See details.

Details

The internal object derived_catalog is used primarily to encode and maintain the parameters required to build each derived factor. In addition, the derived_catalog provides an internal gate-keeping mechanism. Prior to the building procedure, the requested factor must be confirmed as a valid catalog entry. The validation procedure verifies that the unique key formed by hdl, region and frequency maps to an existing entry.

Calling the function derived_catalog_do(operation = 'show') will display all valid catalog entries, including the fields hdl, region and frequency. Consult the derived_catalog_do() function documentation for additional details. The parameter src_dir is usually of the form '/.../Uncompressed' as csv-formatted files must be kept in this directory. Failure to find this source directory will generate an error. In addition, an error will be generated if the region and/or frequency of the parent time-series (e.g existing series required for the building process) do not match the parameters region and frequency in the function call build_derived_factor().

Each derived factor generated by build_derived_factor() has an associated audit file (pdf-formatted) located in the '/.../Audit' directory. Every audit file displays information about the .csv file (paths, attributes, time stamps) containing the derived factor series. In addition, audit files have two fields specific to each derived factor: Proprietary (TRUE / FALSE) and Build Type (Econometric / Algebraic). Yet more fields might appear, especially for factors derived from econometric procedures.

Value

A tibble object, which usually contains 'year' and 'month' as additional variables. Not also that the tibble object is automatically save in the /.../Uncompressed' directory as a csv-formatted file.

Examples

1
2
3
4
5
6
7
8
## Not run: 
US Treasury Term Structure:

build_derived_factor(hdl = 'TERM', region = 'US', frequency = 'M',
src_dir = '~/.../Factor Warehouse/Uncompressed/')


## End(Not run)

fognyc/bindr documentation built on Dec. 4, 2020, 12:33 p.m.