A function that provides access to multiple methods for cleaning outliers from return data.
Return.clean(R, method = c("none", "boudt", "geltner"), alpha = 0.01, ...)
R | an xts, vector, matrix, data frame, timeSeries or zoo object of asset returns |
---|---|
method | one of "none", "boudt", which applies the function
|
alpha | the percentage of outliers you want to clean |
… | additional parameters passed into the underlying cleaning function |
This is a wrapper for offering multiple data cleaning methods for data objects containing returns.
The primary value of data cleaning lies in creating a more robust and stable estimation of the distribution generating the large majority of the return data. The increased robustness and stability of the estimated moments using cleaned data should be used for portfolio construction. If an investor wishes to have a more conservative risk estimate, cleaning may not be indicated for risk monitoring.
In actual practice, it is probably best to back-test the results of both cleaned and uncleaned series to see what works best when forecasting risk with the particular combination of assets under consideration.
In this version, only one method is supported. See
clean.boudt
for more details.
data(managers) head(Return.clean(managers[,1:4]),n=20)#> HAM1 HAM2 HAM3 HAM4 #> 1996-01-31 0.0074 NA 0.0349 0.0222 #> 1996-02-29 0.0193 NA 0.0351 0.0195 #> 1996-03-31 0.0155 NA 0.0258 -0.0098 #> 1996-04-30 -0.0091 NA 0.0449 0.0236 #> 1996-05-31 0.0076 NA 0.0353 0.0028 #> 1996-06-30 -0.0039 NA -0.0303 -0.0019 #> 1996-07-31 -0.0231 NA -0.0337 -0.0446 #> 1996-08-31 0.0395 -0.0001 0.0461 0.0351 #> 1996-09-30 0.0147 0.1002 0.0653 0.0757 #> 1996-10-31 0.0288 0.0338 0.0395 -0.0180 #> 1996-11-30 0.0156 0.0737 0.0666 0.0458 #> 1996-12-31 0.0176 0.0298 0.0214 0.0439 #> 1997-01-31 0.0212 0.0794 0.0771 0.0437 #> 1997-02-28 0.0022 -0.0082 -0.0374 0.0312 #> 1997-03-31 0.0094 -0.0269 -0.0336 0.0113 #> 1997-04-30 0.0126 -0.0061 0.0286 0.0354 #> 1997-05-31 0.0438 0.0539 0.0759 0.0789 #> 1997-06-30 0.0231 0.0552 0.0054 0.0412 #> 1997-07-31 0.0154 0.1150 0.1081 0.0794 #> 1997-08-31 0.0237 -0.0197 -0.0028 0.0143#> Error: requireNamespace("robustbase", quietly = TRUE) is not TRUE