plot.tsfmUpDn: Plot actual against fitted values of up and down market time...

View source: R/plot.tsfmUpDn.r

plot.tsfmUpDnR Documentation

Plot actual against fitted values of up and down market time series factor model

Description

Generic plot method for object of class tsfmUpDn.

Usage

## 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,
  ...
)

Arguments

x

an object of class tsfmUpDn produced by fitTsfmUpDn.

asset.name

A vector of character to show single or multiple assets names. The defualt if NULL.

SFM.line

A logic flag to add a fitted single factor model. The default is FALSE.

LSandRob

A logic flag to add a comparison Up/Down factor model. If the original model is "LS", the comparison model is "Robust" and vice versa. The default is FALSE. The default is FALSE.

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 c("blue","purple").

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 c("dashed","solid".

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 c(1,2.

sfm.line.type

SFM line type. The default is "dashed"

add.legend

A logic flag to add a legend. The default is TRUE.

legend.loc

The default is "topleft".

legend.cex

cex of legend.

...

Other arguments can be used in plot. Please refer to plot.

Details

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.

Author(s)

Yi-An Chen

See Also

fitTsfmUpDn

Examples


# 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")
 
                                                                                                                                     

braverock/factorAnalytics documentation built on Dec. 16, 2024, 1:05 p.m.