register: Model registry

Description Usage Format Details Source References Examples

Description

A registry object to manage model meta data.

Usage

1

Format

The object register contains the following fields, which taken together, describe a model:

Details

The object register uses the infrastructure developed in the package registry, which is endowed with:

The function register$get_fields() generates the register field list, along with associated attributes.

The field hdl controls the handle linked to the meta data associated with the requested model. The function register$get_field_entries('hdl') generates the list of available model handles. The mandatory fields hdl and frequency are combined to form a unique key which supports the registry indexing. For additional details on how to manipulate and query registry objects, please consult the registry package documentation, and in particular the regobj Help Page. See also the registry package vignette from \insertCiteMeyer;textualbindr

The mandatory field src_dir must be a valid and existing directory. An error is generated if any of these conditions is not satisfied. The default value is set internally to SRC_DIRECTORY and can be modified. Note that the field entry will also be validated by the bindr::build_model function.

The mandatory field factor is a list of lists. Each list mirrors the required parameters supplied to the function build_factor, which also implies that each parameter list will be validated by this function. See the example register$set_entry below and the function bindr::build_factor documentation for additional details. The mandatory field factor_count must match the list count in factor. The call register$set_entry generates an error if this condition is not satisfied.

Each factor time-series is aggregated in a common data frame (i.e. a tibble or a similar object) to form a model. The mandatory field join_by is a character string determining which variables will govern the joining operation. More precisely, join_by is the value supplied to the parameter by in the function call plyr::join_all(..., by =).

The logical field certified attests that a model has been certified, i.e that it is has been validated on theoretical and statistical grounds and is therefore suitable for portfolio analysis in the specific realm indicated by the field class (e.g. 'Global', 'MI_Fund', 'MI_Equities', 'Equities', 'Absolute Return', 'Fixed Income', etc). The field protocol indicates which statistical procedure, industry/academic study or process lead to a validated status.

The optional field factor_name is a list of factor labels, intended mostly as a convenient display. Note that the list order and content must match precisely the same attributes implicit in the factor field, otherwise the register$set_entry call generates an error. See the corresponding example below.

The fields lags and region are both optional. The factor model time-series will include lagged series of the original set if lags is set to a value in the range [1, 24], inclusively. Values supplied outside this range generates an error. The field region is arbitrary to some extent and describes the geographic location associated wit the asset, manager or portfolio under consideration (e.g. 'United States', 'Europe', etc).

Finally note that the frequency field (e.g. 'Q' for quarterly) can be matched with a factor list element src_hdl pointing to a source file compiled at the same frequency or higher (e.g. 'M' for monthly). The underlying function call bindr::build_model will transform the data set to the lowest frequency in such cases. Admissible value for the field frequency are 'D', 'W', 'M', 'Q', 'Y', which stands for daily, weekly, monthly, quarterly and yearly, respectively. See the example below with French-Fama 3-Factor Model, Quarterly Frequency, Developed Markets.

Source

Internally defined and non-public.

References

\insertAllCited

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
  ## Not run: 
  # For every model in the registry, show entry
  register[]

  # Generates the registry field list, along with associated attributes
  register$get_fields()

  # Show field 'hdl' and 'lags' value for every model in the registry
  register$get_field_entries('hdl')
  register$get_field_entries('lags')

  # French-Fama 3-Factor Model, Monthly Frequency, United States
  register$set_entry(hdl = 'FF_3F_US', factor_count = 3L, frequency = 'M',
                     certified = FALSE,
                     class = c('MI_Equities', "Equities"),
                     protocol = "FF",
                     region = 'US - United States',
                     join_by = c('year', 'month'),
                     factor = list(
                       list(src_dir = SRC_DIRECTORY,
                            src_hdl = 'FF_3F_US_M',
                            nm = 'mkt',
                            asset = c('mkt'), trade = c(1),
                            arg_supp = list('year','month')),
                       list(src_dir = SRC_DIRECTORY,
                            src_hdl = 'FF_3F_US_M',
                            nm = 'size',
                            asset = c('smb'), trade = c(1),
                            arg_supp = list('year','month')),
                       list(src_dir = SRC_DIRECTORY,
                            src_hdl = 'FF_3F_US_M',
                            nm = 'value',
                            asset = c('hml'), trade = c(1),
                            arg_supp = list('year', 'month'))),
                     factor_name = list('mkt', 'size', 'value'))

  # French-Fama 3-Factor Model, Quarterly Frequency, Developed Markets
  register$set_entry(hdl = 'FF_3F_US', factor_count = 3L, frequency = 'Q',
                     certified = FALSE,
                     class = c('MI_Equities', "Equities"),
                     protocol = "FF",
                     region = 'DEV - Developed Markets',
                     join_by = c('year', 'month'),
                     factor = list(
                       list(src_dir = SRC_DIRECTORY,
                            src_hdl = 'FF_3F_DEV_M',
                            nm = 'mkt',
                            asset = c('mkt'), trade = c(1),
                            arg_supp = list('year','month')),
                       list(src_dir = SRC_DIRECTORY,
                            src_hdl = 'FF_3F_DEV_M',
                            nm = 'size',
                            asset = c('smb'), trade = c(1),
                            arg_supp = list('year','month')),
                       list(src_dir = SRC_DIRECTORY,
                            src_hdl = 'FF_3F_DEV_M',
                            nm = 'value',
                            asset = c('hml'), trade = c(1),
                            arg_supp = list('year', 'month'))),
                     factor_name = list('mkt', 'size', 'value'))

  # Modify previous entry to add 4 lags
  register$modify_entry(hdl = 'FF_3F_US', frequency = 'M', lags = 4L)

  # See model entry
  register$get_entry(hdl = 'FF_3F_US', frequency = 'M')
  
## End(Not run)

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