plot.StatFactorModel: plot StatFactorModel object.

Description Usage Arguments Author(s) Examples

Description

Generic function of plot method for fitStatisticFactorModel. Either plot all assets or choose a single asset to plot.

Usage

1
2
3
4
5
6
7
8
  ## S3 method for class 'StatFactorModel'
 plot(x, variables,
    cumulative = TRUE, style = "bar",
    which.plot = c("none", "1L", "2L", "3L", "4L", "5L", "6L", "7L", "8L"),
    hgrid = FALSE, vgrid = FALSE, plot.single = FALSE,
    asset.name,
    which.plot.single = c("none", "1L", "2L", "3L", "4L", "5L", "6L", "7L", "8L", "9L", "10L", "11L", "12L", "13L"),
    max.show = 6, VaR.method = "historical", ...)

Arguments

x

fit object created by fitStatisticalFactorModel.

variables

Optional. An integer vector shows which variables are to be plotted. The default is to plot all the variables, or the number of variables explaining 90 percent of the variance, whatever is bigger.

cumulative

Logical flag: if TRUE, the cumulative fraction of the variance is printed above each bar in the plot.

style

Charater. bar or lines can be chosen.

which.plot

integer indicating which plot to create: "none" will create a menu to choose. Defualt is none.
1 = "Screeplot of Eigenvalues",
2 = "Factor returns",
3 = "FM Correlation",
4 = "R square",
5 = "Variance of Residuals",
6 = "Factor Contributions to SD",
7 = "Factor Contributions to ES",
8 = "Factor Contributions to VaR"

hgrid

Logic flag. Whether to plot horizontal grid or not. Defualt is FALSE.

vgrid

Logic flag. Whether to plot vertical grid or not. Defualt is FALSE.

plot.single

Plot a single asset of lm class. Defualt is FALSE.

asset.name

Name of the asset to be plotted.

which.plot.single

integer indicating which plot to create: "none" will create a menu to choose. Defualt is none.
1 = time series plot of actual and fitted values,
2 = time series plot of residuals with standard error bands,
3 = time series plot of squared residuals,
4 = time series plot of absolute residuals,
5 = SACF and PACF of residuals,
6 = SACF and PACF of squared residuals,
7 = SACF and PACF of absolute residuals,
8 = histogram of residuals with normal curve overlayed,
9 = normal qq-plot of residuals,
10= CUSUM plot of recursive residuals,
11= CUSUM plot of OLS residuals,
12= CUSUM plot of recursive estimates relative to full sample estimates,
13= rolling estimates over 24 month window.

max.show

Maximum assets to plot. Default is 6.

VaR.method

Character, method for computing VaR. Valid choices are either "modified","gaussian","historical", "kernel". computation is done with the VaR in the PerformanceAnalytics package. Default is "historical".

...

Other variables for barplot method.

Author(s)

Eric Zivot and Yi-An Chen.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
# load data for fitStatisticalFactorModel.r
# data from finmetric berndt.dat and folio.dat

data(stat.fm.data)
# pca
sfm.pca.fit <- fitStatisticalFactorModel(sfm.dat,k=10)
args(plot.StatFactorModel)
# plot all
plot(sfm.pca.fit)
# plot single asset
plot(sfm.pca.fit,plot.single=TRUE,asset.name="CITCRP")

## End(Not run)

R-Finance/FactorAnalytics documentation built on May 8, 2019, 3:51 a.m.