Search code examples
rfinance

Plot issue (actual and fitted values) in factorAnalytics package in R


I am just moving my first steps with the factorAnalytics package. I am running factorAnalytics v.2.0.30 (the latest version AFAIK) in R 3.3.1 (64bit) with RStudio in Windows.

I am running this code (taken from the help of plot.tsfm):

library(factorAnalytics)
data(managers)
fit.macro <- fitTsfm(asset.names=colnames(managers[,(1:6)]),
                     factor.names=colnames(managers[,(7:9)]),
                     rf.name="US.3m.TR", data=managers)

range(index(managers))

plot(fit.macro, plot.single=TRUE, asset.name="HAM1", which=1)

The plot is supposed to show the actual and fitted value of HAM1 over the period 1996-2006, but all I have is this:

Actual and Fitted:HAM1

that is, the graph only shows actual values for 1996 and no fitted values at all. I tried the same instructions with other time series included in the same database and I always get the same issue. I tried to run the same code from the Rgui (to check if it was a RStudio issue) but it did not help.

I would appreciate any suggestion


Solution

  • v2.0.33 is the latest version of factorAnalytics. I have that version on my machine and I am not able to reproduce your issue while running your code. Below attached is the plot I got after running the same code.

    Actual vs Fitted: HAM1

    Can you try installing the most recent version of the package and see if the problem is reproducible.