Learn R Programming

quantmod (version 0.4.17)

specifyModel: Specify Model Formula For quantmod Process

Description

Create a single reusable model specification for subsequent buildModel calls. An object of class quantmod is created that can be then be reused with different modelling methods and parameters. No data frame is specified, as data is retrieved from potentially multiple environments, and internal calls to getSymbols.

Usage

specifyModel(formula, na.rm=TRUE)

Arguments

formula

an object of class formula (or one that can be coerced to that class): a symbolic description of the model to be fitted. The details of model specifcation are given under Details.

na.rm

remove all incomplete rows.

Value

Returns an object of class quantmod. Use modelData to extract full data set as zoo object.

Details

Models are specified through the standard formula mechanism.

As financial models may include a variety of financial and economic indicators, each differing in source, frequency, and/or class, a single mechanism to specify sources is included within a call to specifyModel. See getModelData for details of how this process works.

Currently, objects of class quantmod.OHLC, zoo and ts are supported within the model formula.

All symbols are first retrieved from the global environment, without inheritence. If an object is not found in the global environment, it is added to a list of objects to load through the getSymbols function. getSymbols retrieves each object specified by using information as to its location specified apriori via setDefaults or setSymbolLookup.

Internally all data is coerced to zoo,data.frame, or numeric classes.

References

quantmod.com http://www.quantmod.com

See Also

getModelData,getSymbols, buildModel,tradeModel,formula setSymbolLookup

Examples

Run this code
# NOT RUN {
# if QQQQ is not in the Global environment, an attempt will be made
# to retrieve it from the source specified with getSymbols.Default

specifyModel(Next(OpCl(QQQQ)) ~ Lag(OpHi(QQQQ),0:3) + Hi(DIA))
# }

Run the code above in your browser using DataLab