ffmRsq: Factor Model R-squared and VIF Values

Description Usage Arguments Value Author(s) Examples

View source: R/ffmRsq.R

Description

Calcluate and plot the Factor Model R-squared, Adjusted R-squared and Variance Inflation Factors for a portfolio of assets

Usage

1
2
ffmRsq(ffmObj, rsq = T, rsqAdj = F, VIF = F, plt.type = 2, digits = 2,
  isPrint = T, isPlot = T, lwd = 2, title = TRUE, ...)

Arguments

ffmObj

an object of class ffm produced by fitFfm

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.

VIF

logical; if TRUE, Variance Inflation factor is calculated. Default is FALSE. At least 2 continous variables are required in exposure.vars of fitted model to find VIF.

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.

title

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

...

potentially further arguments passed.

Value

ffmRsq 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)

Doug Martin, Avinash Acharya

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
 ffmRsq(fit)
 
 fit1 <- fitFfm(data=factorDataSetDjia5Yrs, asset.var="TICKER", ret.var="RETURN",
              date.var="DATE", exposure.vars=c("SECTOR", "P2B", "EV2S", "MKTCAP"))

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

AvinashAcharya/Test_factorAnalytics documentation built on May 5, 2019, 9:22 a.m.