View source: R/plot.tsfmUpDn.r
plot.tsfmUpDn | R Documentation |
Generic plot
method for object of class tsfmUpDn
.
## S3 method for class 'tsfmUpDn'
plot(
x,
asset.name = NULL,
SFM.line = FALSE,
LSandRob = FALSE,
line.color = c("blue", "purple"),
line.type = c("dashed", "solid"),
line.width = c(1, 2),
sfm.line.type = "dashed",
add.legend = TRUE,
legend.loc = "topleft",
legend.cex = 0.9,
...
)
x |
an object of class |
asset.name |
A vector of character to show single or multiple assets names. The defualt if
|
SFM.line |
A logic flag to add a fitted single factor model. The default is |
LSandRob |
A logic flag to add a comparison Up/Down factor model. If the original model
is |
line.color |
A vector of color codes of up/dn fitted line. The first element is for the object fitted
line and the second for the comparison fitted line. The default is |
line.type |
A vector of line types of up/dn fitted line. The first is for the object fitted
line and the second for the comparison fitted line. The default is |
line.width |
A vector of line width of up/dn fitted line. The first element is for the object fitted
line and the second element for the comparison fitted line. The default is |
sfm.line.type |
SFM line type. The default is |
add.legend |
A logic flag to add a legend. The default is |
legend.loc |
The default is |
legend.cex |
|
... |
Other arguments can be used in |
This method plots actual values against fitted value of up and down market time series factor model. The dots are actual values and the dashed lines are fitted values. Users can choose to add a single market factor model and a robust up and down model for comaprsion.
For other types of plots, use the list objects Up
and Dn
of class tsfmUpDn
.
The plot.tsfm
can be applied.
Yi-An Chen
fitTsfmUpDn
# load data from the database
data(managers, package = 'PerformanceAnalytics')
colnames(managers) = make.names(colnames(managers))
# example: Up and down market factor model with fit
fitUpDn <- fitTsfmUpDn(asset.names=colnames(managers[,(1:6)]),
mkt.name="SP500.TR", data=managers, fit.method="LS")
# plot the fitted model of every assets, press enter to show the next plot.
plot(fitUpDn)
# or choose to plot one specific asset
plot(fitUpDn,asset.name="HAM1")
# add a single market factor model fitted line
plot(fitUpDn,SFM.line=TRUE,asset.name="HAM1")
# add Robust Up/Dn model fitted line and change legend to
# show the robust up/dn Beta
plot(fitUpDn,LSandRob=TRUE,asset.name="HAM1")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.