braverock / FactorAnalytics

66 stars 62 forks source link

plot.ffm, some chart options not working #70

Open JustinMShea opened 2 years ago

JustinMShea commented 2 years ago

With the following example:

https://github.com/braverock/FactorAnalytics/blob/master/R/plot.ffm.R#L111-L122


data(factorDataSetDjia5Yrs)
# fit a fundamental factor model
exposure.vars <- c("P2B", "MKTCAP")
fit.style.sector <- fitFfm(data=factorDataSetDjia5Yrs, asset.var="TICKER", 
                           ret.var="RETURN", date.var="DATE", 
                           exposure.vars=exposure.vars)

plot(fit.style.sector)

Make a plot selection (or 0 to exit): 

 1: Distribution of factor returns
 2: Factor exposures from the last period
 3: Actual and Fitted asset returns
 4: Time-series of R-squared values
 5: Residual variance across assets
 6: Scatterplot matrix of residuals, with histograms, density overlays, correlations and significance stars
 7: Factor Model Residual Correlation
 8: Factor Model Return Correlation
 9: Factor Contribution to SD
10: Factor Contribution to ES
11: Factor Contribution to VaR
12: Time series of factor returns

option 3: Actual and Fitted asset returns

Error in xts(x, order.by = order.by, frequency = frequency, .CLASS = "double", : 
NROW(x) must match length(order.by)

option 4: Time-series of R-squared values

Doesn't have an error, but chart isn't produced

option 8: Factor Model Return Correlation

rror in cov2cor(fmCov(x)[a.sub, a.sub]) : 
'V' is not a square numeric matrix

Also some, slightly different issues with data.table methodology.

martinrd3D commented 2 years ago

Having reviewed more of the plot.ffm examples in the vignette code Doug_versionOfSangeetha_fitFfmVignette.R, I am near to concluding that we should just do away with plot.ffm, But I will check the examples in the plot.ffm man page and see if I can get them all to work - with Kirk's help. In that case we can just leave plot.ffm in FA for now.

JustinMShea commented 2 years ago

Ok @martinrd3D , just let me know. Any additional updates here? I'll just move it into "Under Review" on the board for now.

martinrd3D commented 2 years ago

Kirk is working on this, and told me yesterday that he was half-way finished.

On Wed, Dec 22, 2021 at 12:53 AM Justin M. Shea @.***> wrote:

Ok, let me know. Any additional updates here? I'll just move it into "Under Review" on the board for now.

— Reply to this email directly, view it on GitHub https://github.com/braverock/FactorAnalytics/issues/70#issuecomment-999398701, or unsubscribe https://github.com/notifications/unsubscribe-auth/AP575Y2DXHUE4TXACZ7ZTY3USGGYXANCNFSM5J5FVSAA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were assigned.Message ID: @.***>

-- R. Douglas Martin Professor Emeritus in Applied Mathematics and Statistics University of Washington

JustinMShea commented 2 years ago

@kecoli I believe your recent PR #82 was to partially fix this issue, though we still have more items to go here.