vif {facmodCS} | R Documentation |
Factor Model Variance Inflaction Factor Values
Description
Calculate and plot the Factor Model Variance Inflaction Factor Values for a fitted model.
A VIF for a single explanatory variable (style factor) is obtained using the time series of R-squared values obtained from
the regression of that variable against all other explanatory variables.
So, at least 2 explanatory variables are required in exposure.vars
of fitted model to find the VIF.
Usage
vif(
ffmObj,
digits = 2,
isPrint = TRUE,
isPlot = TRUE,
lwd = 2,
stripText.cex = 1,
axis.cex = 1,
title = TRUE,
...
)
Arguments
ffmObj |
an object of class |
digits |
an integer indicating the number of decimal places to be used for rounding. Default is 2. |
isPrint |
logical. if |
isPlot |
logical. if |
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. This argument is mainly used for the documentation purpose when you need a plot without any title.
If |
... |
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)
Avinash Acharya
Examples
library(PCRA)
# load data
data(stocksCRSP)
data(factorsSPGMI)
dateRange <- c("2006-01-31","2010-12-31")
stockItems <- c("Date", "TickerLast", "CapGroupLast", "Return",
"Ret13WkBill","MktIndexCRSP","Sector")
factorItems <- c("BP","Beta60M","PM12M1M")
stocks_factors <- selectCRSPandSPGMI("monthly", dateRange = dateRange,
stockItems = stockItems, factorItems = factorItems, outputType ="data.table")
# fit a fundamental factor model with style variables BP and LogMktCap
fundamental_model <- fitFfm(data = stocks_factors,
asset.var = "TickerLast",
ret.var = "Return",
date.var = "Date",
exposure.vars = c("BP", "PM12M1M")
)
#Plot and print the time series of VIF values
vif(fundamental_model,isPrint=TRUE)