R/SFM.fit.models.R
SFM.fit.models.RdThis function provies a simple plug and play option for user to compare the SFM estimates by lm and lmrobdetMM functions, using the fit.models framework. This will allow for an easier comparison using charts and tables
SFM.fit.models(
Ra,
Rb,
Rf = 0,
family = "mopt",
which.plots = NULL,
plots = TRUE
)an xts, vector, matrix, data frame, timeSeries or zoo object of asset returns
return vector of the benchmark asset
risk free rate, in same period as your returns
(Optional): If method == "Robust": This is a string specifying the name of the family of loss function to be used (current valid options are "bisquare", "opt" and "mopt"). Incomplete entries will be matched to the current valid options. Defaults to "mopt". Else: the parameter is ignored
specify the plot numbers that you want to see. Default option is that program will ask you to choose a plot
Boolean to output plots after the function. Defaults to TRUE
if (FALSE) { # \dontrun{
# First we load the data
data(managers)
mgrs <- managers["2002/"] # So that all have managers have complete history
names(mgrs)[7:10] <- c("LSEQ","SP500","Bond10Yr","RF") # Short names for last 3
# NOTE: Use plots=TRUE to be able to see plots
fitModels <- SFM.fit.models(mgrs$HAM1,mgrs$SP500,Rf = mgrs$RF, plots=FALSE)
coef(fitModels)
summary(fitModels)
class(fitModels)
SFM.fit.models(mgrs$HAM1, mgrs$SP500, Rf = mgrs$RF, plots=FALSE)
SFM.fit.models(mgrs[,6], mgrs[,8], Rf=.035/12, plots=FALSE)
SFM.fit.models(mgrs$HAM6, mgrs$SP500, Rf=.035/12, family = "mopt",
which.plots = c(1,2), plots=FALSE)
SFM.fit.models(mgrs$HAM2, mgrs$SP500, Rf = mgrs$RF, family = "opt",
plots=FALSE)
} # }