fmRsq: Factor Model R-Squared and Adj R-Squared Values

Description Usage Arguments Value Author(s) Examples

View source: R/fmRsq.R

Description

Calcluate and plot the Factor Model R-Squared, Adjusted R-Squared for a portfolio of assets

Usage

1
2
3
4
5
6
fmRsq(ffmObj, ...)

## S3 method for class 'ffm'
fmRsq(ffmObj, rsq = T, rsqAdj = F, plt.type = 2,
  digits = 2, isPrint = T, isPlot = T, lwd = 2, stripText.cex = 1,
  axis.cex = 1, title = TRUE, ...)

Arguments

ffmObj

an object of class ffm produced by fitFfm

...

potentially further arguments passed.

rsq

logical; if TRUE, Factor Model R-squared values are computed for the portfolio. Default is TRUE.

rsqAdj

logical; if TRUE, Adjusted R-squared values are computed for the portfolio. Default is FALSE.

plt.type

a number to indicate the type of plot for plotting Factor Model R-squared/Adj. R-squared values. 1 indicates barplot, 2 indicates time series xy plot. Default is 2.

digits

an integer indicating the number of decimal places to be used for rounding. Default is 2.

isPrint

logical. if TRUE, the time series of the computed factor model values is printed along with their mean values. Else, only the mean values are printed. Default is TRUE.

isPlot

logical. if TRUE, the time series of the output is plotted. Default is TRUE.

lwd

line width relative to the default. Default is 2.

stripText.cex

a number indicating the amount by which strip text in the plot(s) should be scaled relative to the default. 1=default, 1.5 is 50% larger, 0.5 is 50% smaller, etc.

axis.cex

a number indicating the amount by which axis in the plot(s) should be scaled relative to the default. 1=default, 1.5 is 50% larger, 0.5 is 50% smaller, etc.

title

logical. if TRUE, the plots will have the main tiltle. default is TRUE.

Value

fmRsq returns the sample mean values and plots the time series of corresponding R squared values and the Variance Inflation factors depending on the values of rsq, rsqAdj and VIF. The time series of the output values are also printed if isPrint is TRUE

Author(s)

Avinash Acharya and Doug Martin

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#Load the data
 data("factorDataSetDjia5Yrs")

#Fit a Ffm
require(factorAnalytics)
 fit <- fitFfm(data=factorDataSetDjia5Yrs, asset.var="TICKER", ret.var="RETURN",
              date.var="DATE", exposure.vars="SECTOR")

#Calcuate and plot the portfolio R-squared values
 fmRsq(fit)
 
 fit1 <- fitFfm(data=factorDataSetDjia5Yrs, asset.var="TICKER", ret.var="RETURN",
              date.var="DATE", exposure.vars=c("SECTOR", "P2B", "EV2S", "MKTCAP"), addIntercept=TRUE)

#Plot and print the time series of Adj R-squared and VIF values
 fmRsq(fit1, rsqAdj=TRUE, isPrint=TRUE, plt.type = 2)

sangeeuw/factorAnalytics documentation built on May 28, 2019, 3:40 p.m.