[Returnanalytics-commits] r3572 - in pkg/FactorAnalytics: . R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Dec 7 07:36:05 CET 2014


Author: pragnya
Date: 2014-12-07 07:36:03 +0100 (Sun, 07 Dec 2014)
New Revision: 3572

Modified:
   pkg/FactorAnalytics/DESCRIPTION
   pkg/FactorAnalytics/NAMESPACE
   pkg/FactorAnalytics/R/fitSfm.R
   pkg/FactorAnalytics/R/plot.sfm.r
   pkg/FactorAnalytics/R/summary.sfm.r
   pkg/FactorAnalytics/man/plot.sfm.Rd
   pkg/FactorAnalytics/man/summary.sfm.Rd
Log:
Added summary, plot for factor mimicking portfolios. Updated plot.sfm options.

Modified: pkg/FactorAnalytics/DESCRIPTION
===================================================================
--- pkg/FactorAnalytics/DESCRIPTION	2014-12-06 06:21:16 UTC (rev 3571)
+++ pkg/FactorAnalytics/DESCRIPTION	2014-12-07 06:36:03 UTC (rev 3572)
@@ -1,8 +1,8 @@
 Package: factorAnalytics
 Type: Package
 Title: Factor Analytics
-Version: 2.0.7
-Date: 2014-12-05
+Version: 2.0.8
+Date: 2014-12-06
 Author: Eric Zivot, Sangeetha Srinivasan and Yi-An Chen
 Maintainer: Sangeetha Srinivasan <sangee at uw.edu>
 Description: An R package for the estimation and risk analysis of linear factor
@@ -27,7 +27,8 @@
     strucchange,
     lmtest,
     sandwich,
-    lattice
+    lattice,
+    MASS
 Suggests:
     testthat, quantmod, knitr
 LazyLoad: yes

Modified: pkg/FactorAnalytics/NAMESPACE
===================================================================
--- pkg/FactorAnalytics/NAMESPACE	2014-12-06 06:21:16 UTC (rev 3571)
+++ pkg/FactorAnalytics/NAMESPACE	2014-12-07 06:36:03 UTC (rev 3572)
@@ -38,6 +38,7 @@
 export(paFm)
 export(qCornishFisher)
 export(rCornishFisher)
+importFrom(MASS,ginv)
 importFrom(PerformanceAnalytics,Return.cumulative)
 importFrom(PerformanceAnalytics,VaR)
 importFrom(PerformanceAnalytics,chart.ACFplus)

Modified: pkg/FactorAnalytics/R/fitSfm.R
===================================================================
--- pkg/FactorAnalytics/R/fitSfm.R	2014-12-06 06:21:16 UTC (rev 3571)
+++ pkg/FactorAnalytics/R/fitSfm.R	2014-12-07 06:36:03 UTC (rev 3572)
@@ -150,6 +150,7 @@
 #' fit.apca.ck <- fitSfm(r.W, k="ck")
 #' 
 #' @importFrom PerformanceAnalytics checkData
+#' @importFrom MASS ginv
 #' 
 #' @export
 
@@ -270,7 +271,7 @@
   Omega.fm <- B %*% var(f) %*% t(B) + diag(resid.sd^2)
   
   # compute factor mimicking portfolio weights: NxK
-  mimic <- X / colSums(X)
+  mimic <- t(t(X)/colSums(X))
   
   # assign row and column names
   names(eig.val) <- paste("F", 1:n, sep = ".")
@@ -338,7 +339,8 @@
   Omega.fm <- B %*% var(f) %*% t(B) + diag(resid.sd^2)
   
   # compute factor mimicking portfolio weights
-  mimic <- X / colSums(X)
+  mimic <- ginv(R.mat) %*% f
+  mimic <- t(t(mimic)/colSums(mimic))
   
   # extract r2, residuals
   resid.xts <- do.call(merge, sapply(X=summary(asset.fit), FUN="[", "residuals"))
@@ -346,7 +348,7 @@
   
   # assign row and column names
   names(eig.val) = paste("F", 1:obs, sep = ".")
-  names(r2) = names(resid.sd) = colnames(R.xts)
+  names(r2) = names(resid.sd) = rownames(mimic) = colnames(R.xts)
   colnames(B) = colnames(f)
   
   # return list

Modified: pkg/FactorAnalytics/R/plot.sfm.r
===================================================================
--- pkg/FactorAnalytics/R/plot.sfm.r	2014-12-06 06:21:16 UTC (rev 3571)
+++ pkg/FactorAnalytics/R/plot.sfm.r	2014-12-07 06:36:03 UTC (rev 3572)
@@ -11,8 +11,9 @@
 #' \code{loop=FALSE} will exit after plotting any one chosen characteristic 
 #' without the need for menu selection.
 #' 
-#' Group plots are the default. The first \code{n.max} variables and 
-#' \code{n.max} factors are plotted depending on the characteristic chosen. 
+#' Group plots are the default. The variables in \code{asset.subset} and factors
+#' in \code{asset.subset} are plotted depending on the characteristic chosen. 
+#' The default is to show the first 4 factors and first 5 assets.
 #' 
 #' Individual asset plots are selected by specifying \code{plot.single=TRUE}. 
 #' In which case, \code{asset.name} is necessary if multiple assets 
@@ -27,16 +28,20 @@
 #' 2 = Time series plot of estimated factors, \cr
 #' 3 = Estimated factor loadings, \cr
 #' 4 = Histogram of R-squared, \cr
-#' 5 = Histogram of Residual volatility,\cr
+#' 5 = Histogram of residual volatility,\cr
 #' 6 = Factor model residual correlation \cr
 #' 7 = Factor model correlation,\cr
 #' 8 = Factor contribution to SD,\cr
 #' 9 = Factor contribution to ES,\cr
-#' 10 = Factor contribution to VaR
-#' @param k.max maximum number of factors to add per plot device for group 
-#' plots. Default is 6.
-#' @param n.max maximum number of variables to add per plot device for group 
-#' plots. Default is 10. 
+#' 10 = Factor contribution to VaR, \cr
+#' 11 = Factor mimicking portfolio weights - top long and short positions in each factor, \cr
+#' 12 = Asset correlations - top long and short positions in each factor
+#' @param factor.subset vector of names/indices of factors to show for group 
+#' plots. Default is 1:4.
+#' @param asset.subset vector of names/indices of assets to show for group 
+#' plots. Default is 1:5. 
+#' @param n.top scalar; number of largest and smallest weights to display for 
+#' each factor mimicking portfolio. Default is 3.
 #' @param plot.single logical; If \code{TRUE} plots the characteristics of an 
 #' individual asset's factor model. The type of plot is given by 
 #' \code{which.plot.single}. Default is \code{FALSE}.
@@ -112,7 +117,7 @@
 #' 
 #' # plot the factor betas of 1st 4 assets fitted above
 #' # loop disabled to get one type of plot without interative menu
-#' plot(fit.apca, n.max=4, which.plot.group=3, loop=FALSE)
+#' plot(fit.apca, asset.subset=1:4, which.plot.group=3, loop=FALSE)
 #' 
 #' # plot factor model return correlation; angular order of the eigenvectors
 #' plot(fit.apca, which.plot.group=7, loop=FALSE, 
@@ -131,11 +136,11 @@
 #' @method plot sfm
 #' @export
 
-plot.sfm <- function(x, which.plot.group=NULL, k.max=6, n.max=10, 
-                     plot.single=FALSE, asset.name, which.plot.single=NULL, 
-                     colorset=(1:12), legend.loc="topleft", las=1, 
-                     VaR.method="historical", cum.var=TRUE, eig.max=0.9, 
-                     loop=TRUE, ...) {
+plot.sfm <- function(x, which.plot.group=NULL, factor.subset=1:4, 
+                     asset.subset=1:5, n.top=3, plot.single=FALSE, asset.name, 
+                     which.plot.single=NULL, colorset=(1:12), 
+                     legend.loc="topleft", las=1, VaR.method="historical", 
+                     cum.var=TRUE, eig.max=0.9, loop=TRUE, ...) {
   
   if (plot.single==TRUE) {
     
@@ -272,63 +277,62 @@
                  "Time series plot of estimated factors",
                  "Estimated factor loadings", 
                  "Histogram of R-squared", 
-                 "Histogram of Residual volatility", 
+                 "Histogram of residual volatility", 
                  "Factor model residual correlation",
                  "Factor model return correlation",
                  "Factor contribution to SD", 
                  "Factor contribution to ES", 
-                 "Factor contribution to VaR"), 
+                 "Factor contribution to VaR",
+                 "Factor mimicking portfolio weights - top long and short positions in each factor",
+                 "Asset correlations - top long and short positions in each factor"), 
                title="\nMake a plot selection (or 0 to exit):") 
       }
       
       par(las=las) # default horizontal axis labels
       k <- x$k
+      f.names <- paste("F", 1:k, sep = ".")
+      a.names <- x$asset.names
       n <- nrow(x$loadings)
       
+      if (!(all(factor.subset %in% f.names) || all(factor.subset %in% 1:k))) {
+        stop("Invalid argument: factor.subset is not a valid subset of factor names in the fit object.") 
+      }
+      if (!(all(asset.subset %in% a.names) || all(asset.subset %in% 1:n))) {
+        stop("Invalid argument: factor.subset is not a valid subset of factor names in the fit object.") 
+      }
+      
       switch(which.plot.group,
              "1L" = { 
                ## Screeplot of eigenvalues
                cumv <- cumsum(x$eigen)/sum(x$eigen)
                limit <- length(cumv[cumv<eig.max]) + 1
-               eig.pct <- (x$eigen/sum(x$eigen))[1:limit]
-               scree <- barplot(eig.pct, main="Screeplot of eigenvalues", 
-                                ylab="Proportion of Variance", col="darkblue", 
-                                ylim=c(0, 1.1*max(eig.pct)), las=las, ...)
+               eig <- x$eigen[1:limit]
+               scree <- barplot(eig, main="Screeplot of eigenvalues", 
+                                ylab="Variance", col="darkblue", 
+                                ylim=c(0, 1.1*max(eig)), las=las, ...)
                if (cum.var) {
-                 text(scree, eig.pct, label=round(cumv,3), pos=3, cex=0.75)
+                 text(scree, eig, label=round(cumv[1:limit],3), pos=3, cex=0.75)
                }
              }, 
              "2L" = {
                ## Time series plot of estimated factors
-               if (k > k.max) {
-                 cat(paste("Displaying only the first", k.max,"factors, as the number of factors > 'k.max' =", k.max))
-                 k <- k.max 
-               }
                plot(
-                 xyplot(x$factors[,1:k],type=c("l","g"),xlab="", 
-                        scales=list(y=list(rot=0)), strip.left=TRUE, strip=FALSE)
+                 xyplot(x$factors[,factor.subset], type=c("l","g"), xlab="", 
+                        scales=list(y=list(rot=0)), strip.left=TRUE, strip=FALSE, ...)
                )
              }, 
              "3L" = {    
                ## Estimated factor loadings
-               if (k > k.max) {
-                 cat(paste("Displaying only the first", k.max,"factors, as the number of factors > 'k.max' =", k.max))
-                 k <- k.max 
-               }
-               if (n > n.max) {
-                 cat(paste("Displaying only the first", n.max,"variables, as the number of variables > 'n.max' =", n.max))
-                 n <- n.max 
-               }
-               par(mfrow=c(ceiling(k/2),2))
-               for (i in 1:k) {
+               par(mfrow=c(ceiling(length(factor.subset)/2),2))
+               for (i in factor.subset) {
                  main=paste("Beta values for ", colnames(x$loadings)[i])
-                 barplot(x$loadings[1:n,i], main=main, names.arg=x$asset.names[1:n], 
+                 barplot(x$loadings[asset.subset,i], main=main, names.arg=asset.subset, 
                          col="darkblue", las=las, horiz=TRUE, ...)
                  abline(v=0, lwd=1, lty=1, col=1)
                }
                par(mfrow=c(1,1))
              }, 
-             "4L" ={
+             "4L" = {
                ## Histogram of R-squared
                methods <- c("add.density","add.rug")
                chart.Histogram(x$r2, xlab="R-squared",
@@ -344,35 +348,19 @@
              }, 
              "6L" = {
                ## Factor Model Residual Correlation
-               if (n > n.max) {
-                 cat(paste("Displaying only the first", n.max,"variables, as the number of variables > 'n.max' =", n.max))
-                 n <- n.max 
-               }
-               cor.resid <- cor(residuals(x)[,1:n], use="pairwise.complete.obs")
+               cor.resid <- cor(residuals(x)[,asset.subset], use="pairwise.complete.obs")
                corrplot(cor.resid, ...)
                # mtext("pairwise complete obs", line=0.5)
              }, 
              "7L" = {
                ## Factor Model Return Correlation
-               if (n > n.max) {
-                 cat(paste("Displaying only the first", n.max,"variables, as the number of variables > 'n.max' =", n.max))
-                 n <- n.max 
-               }
-               cor.fm <- cov2cor(fmCov(x))[1:n,1:n]
+               cor.fm <- cov2cor(fmCov(x))[asset.subset,asset.subset]
                corrplot(cor.fm, ...)
                # mtext("pairwise complete obs", line=0.5)
              },
              "8L" = {
                ## Factor Percentage Contribution to SD
-               if (k > k.max) {
-                 cat(paste("Displaying only the first", k.max,"factors, as the number of factors > 'k.max' =", k.max))
-                 k <- k.max 
-               }
-               if (n > n.max) {
-                 cat(paste("Displaying only the first", n.max,"variables, as the number of variables > 'n.max' =", n.max))
-                 n <- n.max 
-               }
-               pcSd.fm <- fmSdDecomp(x)$pcSd[1:n,1:k]
+               pcSd.fm <- fmSdDecomp(x)$pcSd[asset.subset,factor.subset]
                plot(
                  barchart(pcSd.fm, main="Factor % Contribution to SD", xlab="",
                           auto.key=list(space="bottom",columns=3, 
@@ -382,17 +370,9 @@
                                               panel.barchart(...)}, ...)
                )
              },
-             "9L"={
+             "9L" = {
                ## Factor Percentage Contribution to ES
-               if (k > k.max) {
-                 cat(paste("Displaying only the first", k.max,"factors, as the number of factors > 'k.max' =", k.max))
-                 k <- k.max 
-               }
-               if (n > n.max) {
-                 cat(paste("Displaying only the first", n.max,"variables, as the number of variables > 'n.max' =", n.max))
-                 n <- n.max 
-               }
-               pcES.fm <- fmEsDecomp(x, method=VaR.method)$pcES[1:n,1:k]
+               pcES.fm <- fmEsDecomp(x, method=VaR.method)$pcES[asset.subset,factor.subset]
                plot(
                  barchart(pcES.fm, main="Factor % Contribution to ES", xlab="",
                           auto.key=list(space="bottom",columns=3, 
@@ -402,17 +382,9 @@
                                               panel.barchart(...)}, ...)
                )
              },
-             "10L" ={
+             "10L" = {
                ## Factor Percentage Contribution to VaR
-               if (k > k.max) {
-                 cat(paste("Displaying only the first", k.max,"factors, as the number of factors > 'k.max' =", k.max))
-                 k <- k.max 
-               }
-               if (n > n.max) {
-                 cat(paste("Displaying only the first", n.max,"variables, as the number of variables > 'n.max' =", n.max))
-                 n <- n.max 
-               }
-               pcVaR.fm <- fmVaRDecomp(x, method=VaR.method)$pcVaR[1:n,1:k]
+               pcVaR.fm <- fmVaRDecomp(x, method=VaR.method)$pcVaR[asset.subset,factor.subset]
                plot(
                  barchart(pcVaR.fm, main="Factor % Contribution to VaR", 
                           xlab="", auto.key=list(space="bottom",columns=3, 
@@ -422,6 +394,30 @@
                                               panel.barchart(...)}, ...)
                )
              },
+             "11L" = {
+               ## Factor mimicking portfolio weights - top long and short positions in each factor
+               par(mfrow=c(ceiling(length(factor.subset)/2),2))
+               for (i in factor.subset) {
+                 main=paste("Top positions in ", colnames(x$loadings)[i])
+                 s <- summary(x, n.top=n.top)$mimic.sum[[i]]
+                 top <- as.numeric(s[,c(2,4)])
+                 names.arg <- as.vector(s[,c(1,3)])
+                 barplot(top, main=main, names.arg=names.arg, col="darkblue", 
+                         las=las, horiz=TRUE, ...)
+                 abline(v=0, lwd=1, lty=1, col=1)
+               }
+               par(mfrow=c(1,1))
+             },
+             "12L" = {
+               ## Asset correlations - top long and short positions in each factor
+               for (i in factor.subset) {
+                 main=paste("Correlations of top positions in ", colnames(x$loadings)[i])
+                 s <- summary(x, n.top=n.top)$mimic.sum[[i]]
+                 names.arg <- as.vector(s[,c(1,3)])
+                 cor.fm <- cov2cor(fmCov(x))[names.arg,names.arg]
+                 corrplot(cor.fm, ...)
+               }
+             },
              invisible()       
       )         
       # repeat menu if user didn't choose to exit from the plot options

Modified: pkg/FactorAnalytics/R/summary.sfm.r
===================================================================
--- pkg/FactorAnalytics/R/summary.sfm.r	2014-12-06 06:21:16 UTC (rev 3571)
+++ pkg/FactorAnalytics/R/summary.sfm.r	2014-12-07 06:36:03 UTC (rev 3572)
@@ -13,6 +13,8 @@
 #' @param object an object of class \code{sfm} returned by \code{fitSfm}.
 #' @param se.type one of "Default", "HC" or "HAC"; option for computing HC/HAC 
 #' standard errors and t-statistics.
+#' @param n.top scalar; number of largest and smallest weights to display for 
+#' each factor mimicking portfolio. Default is 3.
 #' @param x an object of class \code{summary.sfm}.
 #' @param digits number of significants digits to use when printing. 
 #' Default is 3.
@@ -21,14 +23,16 @@
 #' @return Returns an object of class \code{summary.sfm}. 
 #' The print method for class \code{summary.sfm} outputs the call, 
 #' coefficients (with standard errors and t-statistics), r-squared and 
-#' residual volatilty (under the homoskedasticity assumption) for all assets. 
+#' residual volatilty (under the homoskedasticity assumption) for all assets as 
+#' well as a summary of the factor mimicking portfolio weights.
 #' 
 #' Object of class \code{summary.sfm} is a list of length N+2 containing:
 #' \item{call}{the function call to \code{fitSfm}}
 #' \item{se.type}{standard error type as input} 
 #' \item{sum.list}{list of summaries for the N fit objects of class \code{lm} 
 #' for each asset in the factor model.}
-#' \item{mimic}{N x K matrix of factor mimicking portfolio weights.}
+#' \item{mimic.sum}{list of matrices containing \code{n.top} largest and 
+#' smallest weights for each factor mimicking portfolio.}
 #' 
 #' @author Sangeetha Srinivasan
 #' 
@@ -48,7 +52,7 @@
 #' @method summary sfm
 #' @export
 
-summary.sfm <- function(object, se.type="Default", ...){
+summary.sfm <- function(object, se.type="Default", n.top=3, ...){
   
   # check input object validity
   if (!inherits(object, "sfm")) {
@@ -72,9 +76,22 @@
     }
   }
   
+  # get n.top largest and smallest weights for each factor mimicking portfolio
+  mimic <- object$mimic
+  mimic.sum <- list()
+  for (j in 1:object$k) {
+    short <- sort(mimic[,j])[1:n.top]
+    long <- sort(mimic[,j], decreasing=TRUE)[1:n.top]
+    mimic.sum[[j]] <- cbind(names(long),long,names(short),short)
+    rownames(mimic.sum[[j]]) <- 1:n.top
+    colnames(mimic.sum[[j]]) <- c("Top.Long.Name", "Top.Long.Weight", 
+                                  "Top.Short.Name", "Top.Short.Weight")
+  }
+  names(mimic.sum) <- paste("F", 1:object$k, sep = ".")
+  
   # include the call and se.type to fitSfm
   sum <- list(call=object$call, se.type=se.type, sum.list=sum.list, 
-              mimic=object$mimic)
+              mimic.sum=mimic.sum)
   class(sum) <- "summary.sfm"
   return(sum)
 }
@@ -105,4 +122,6 @@
     printCoefmat(table.coef, digits=digits, ...)
     cat("\nR-squared: ", r2,", Residual Volatility: ", sigma,"\n", sep="")
   }
+  cat("\nFactor mimicking portfolio weights:\n\n", sep="")
+  print(x$mimic.sum, digits=digits, ...)
 }

Modified: pkg/FactorAnalytics/man/plot.sfm.Rd
===================================================================
--- pkg/FactorAnalytics/man/plot.sfm.Rd	2014-12-06 06:21:16 UTC (rev 3571)
+++ pkg/FactorAnalytics/man/plot.sfm.Rd	2014-12-07 06:36:03 UTC (rev 3572)
@@ -3,11 +3,11 @@
 \alias{plot.sfm}
 \title{Plots from a fitted statistical factor model}
 \usage{
-\method{plot}{sfm}(x, which.plot.group = NULL, k.max = 6, n.max = 10,
-  plot.single = FALSE, asset.name, which.plot.single = NULL,
-  colorset = (1:12), legend.loc = "topleft", las = 1,
-  VaR.method = "historical", cum.var = TRUE, eig.max = 0.9, loop = TRUE,
-  ...)
+\method{plot}{sfm}(x, which.plot.group = NULL, factor.subset = 1:4,
+  asset.subset = 1:5, n.top = 3, plot.single = FALSE, asset.name,
+  which.plot.single = NULL, colorset = (1:12), legend.loc = "topleft",
+  las = 1, VaR.method = "historical", cum.var = TRUE, eig.max = 0.9,
+  loop = TRUE, ...)
 }
 \arguments{
 \item{x}{an object of class \code{sfm} produced by \code{fitSfm}.}
@@ -18,19 +18,24 @@
 2 = Time series plot of estimated factors, \cr
 3 = Estimated factor loadings, \cr
 4 = Histogram of R-squared, \cr
-5 = Histogram of Residual volatility,\cr
+5 = Histogram of residual volatility,\cr
 6 = Factor model residual correlation \cr
 7 = Factor model correlation,\cr
 8 = Factor contribution to SD,\cr
 9 = Factor contribution to ES,\cr
-10 = Factor contribution to VaR}
+10 = Factor contribution to VaR, \cr
+11 = Factor mimicking portfolio weights - top long and short positions in each factor, \cr
+12 = Asset correlations - top long and short positions in each factor}
 
-\item{k.max}{maximum number of factors to add per plot device for group
-plots. Default is 6.}
+\item{factor.subset}{vector of names/indices of factors to show for group
+plots. Default is 1:4.}
 
-\item{n.max}{maximum number of variables to add per plot device for group
-plots. Default is 10.}
+\item{asset.subset}{vector of names/indices of assets to show for group
+plots. Default is 1:5.}
 
+\item{n.top}{scalar; number of largest and smallest weights to display for
+each factor mimicking portfolio. Default is 3.}
+
 \item{plot.single}{logical; If \code{TRUE} plots the characteristics of an
 individual asset's factor model. The type of plot is given by
 \code{which.plot.single}. Default is \code{FALSE}.}
@@ -95,8 +100,9 @@
 \code{loop=FALSE} will exit after plotting any one chosen characteristic
 without the need for menu selection.
 
-Group plots are the default. The first \code{n.max} variables and
-\code{n.max} factors are plotted depending on the characteristic chosen.
+Group plots are the default. The variables in \code{asset.subset} and factors
+in \code{asset.subset} are plotted depending on the characteristic chosen.
+The default is to show the first 4 factors and first 5 assets.
 
 Individual asset plots are selected by specifying \code{plot.single=TRUE}.
 In which case, \code{asset.name} is necessary if multiple assets
@@ -117,7 +123,7 @@
 
 # plot the factor betas of 1st 4 assets fitted above
 # loop disabled to get one type of plot without interative menu
-plot(fit.apca, n.max=4, which.plot.group=3, loop=FALSE)
+plot(fit.apca, asset.subset=1:4, which.plot.group=3, loop=FALSE)
 
 # plot factor model return correlation; angular order of the eigenvectors
 plot(fit.apca, which.plot.group=7, loop=FALSE,

Modified: pkg/FactorAnalytics/man/summary.sfm.Rd
===================================================================
--- pkg/FactorAnalytics/man/summary.sfm.Rd	2014-12-06 06:21:16 UTC (rev 3571)
+++ pkg/FactorAnalytics/man/summary.sfm.Rd	2014-12-07 06:36:03 UTC (rev 3572)
@@ -4,7 +4,7 @@
 \alias{summary.sfm}
 \title{Summarizing a fitted time series factor model}
 \usage{
-\method{summary}{sfm}(object, se.type = "Default", ...)
+\method{summary}{sfm}(object, se.type = "Default", n.top = 3, ...)
 
 \method{print}{summary.sfm}(x, digits = 3, ...)
 }
@@ -14,6 +14,9 @@
 \item{se.type}{one of "Default", "HC" or "HAC"; option for computing HC/HAC
 standard errors and t-statistics.}
 
+\item{n.top}{scalar; number of largest and smallest weights to display for
+each factor mimicking portfolio. Default is 3.}
+
 \item{...}{futher arguments passed to or from other methods.}
 
 \item{x}{an object of class \code{summary.sfm}.}
@@ -25,14 +28,16 @@
 Returns an object of class \code{summary.sfm}.
 The print method for class \code{summary.sfm} outputs the call,
 coefficients (with standard errors and t-statistics), r-squared and
-residual volatilty (under the homoskedasticity assumption) for all assets.
+residual volatilty (under the homoskedasticity assumption) for all assets as
+well as a summary of the factor mimicking portfolio weights.
 
 Object of class \code{summary.sfm} is a list of length N+2 containing:
 \item{call}{the function call to \code{fitSfm}}
 \item{se.type}{standard error type as input}
 \item{sum.list}{list of summaries for the N fit objects of class \code{lm}
 for each asset in the factor model.}
-\item{mimic}{N x K matrix of factor mimicking portfolio weights.}
+\item{mimic.sum}{list of matrices containing \code{n.top} largest and
+smallest weights for each factor mimicking portfolio.}
 }
 \description{
 \code{summary} method for object of class \code{sfm}.



More information about the Returnanalytics-commits mailing list