
method
to quantmod
object.buildModel(x, training.per, method, ...)
quantmod
created with specifyModel
or
an Rformulaquantmod
with fitted model attachedlm, glm, loess, step, ppr, rpart[rpart], tree[tree], randomForest[randomForest], mars[mda], polymars[polspline], lars[lars], rq[quantreg], lqs[MASS], rlm[MASS], and nnet[nnet].
Additional methods wrappers can be created to allow for modelling
using custom functions. The only requirements are for a wrapper
function to be constructed taking parameters quantmod
,
training.data
, and .... The function must return the
fitted model object and have a predict method available.
It is possible to add predict methods if non exist by
adding an S3 method for predictModel. The buildModel.skeleton
function can be used for new methods.
specifyModel
tradeModel
getSymbols('QQQQ',src='yahoo')
q.model = specifyModel(Next(OpCl(QQQQ)) ~ Lag(OpHi(QQQQ),0:3))
buildModel(q.model,method='lm',training.per=c('2006-08-01','2006-09-30'))
Run the code above in your browser using DataLab