[Returnanalytics-commits] r2455 - in pkg/FactorAnalytics: R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Jun 28 00:14:45 CEST 2013
Author: chenyian
Date: 2013-06-28 00:14:44 +0200 (Fri, 28 Jun 2013)
New Revision: 2455
Modified:
pkg/FactorAnalytics/R/predict.TimeSeriesFactorModel.r
pkg/FactorAnalytics/man/impliedFactorReturns.Rd
pkg/FactorAnalytics/man/predict.TimeSeriesFactorModel.Rd
Log:
start skeleton of summary.FundamentalFactorModel.r and summary.FundamentalFactorModel.Rd
Modified: pkg/FactorAnalytics/R/predict.TimeSeriesFactorModel.r
===================================================================
--- pkg/FactorAnalytics/R/predict.TimeSeriesFactorModel.r 2013-06-27 16:55:34 UTC (rev 2454)
+++ pkg/FactorAnalytics/R/predict.TimeSeriesFactorModel.r 2013-06-27 22:14:44 UTC (rev 2455)
@@ -29,30 +29,30 @@
if (missing(newdata) || is.null(newdata) ) {
lapply(fit$asset.fit, predict,...)
}
- if ( !(missing(newdata) && !is.null(newdata) )) {
- numAssets <- length(names(fit$asset.fit))
-
- data <- fit$data
- factors <- data[,fit$factors.names]
- mu.factors <- apply(factors,2,mean)
- cov.factors <- cov(factors)
-
- for (i in 1:numAssets)
- if (dim(newdata)[1] < length(residuals(fit$asset.fit[[1]])) ){
-
-
- newdata <- data.frame(EDHEC.LS.EQ = rnorm(n=100), SP500.TR = rnorm(n=100) )
- newdata.mat <- as.matrix(newdata)
- factor.scenarios <- 0.001
- names(factor.scenarios) <- "SP500.TR"
-
- impliedFactorReturns(factor.scenarios, mu.factors, cov.factors)
-
- }
-
-
-
- }
+# if ( !(missing(newdata) && !is.null(newdata) )) {
+# numAssets <- length(names(fit$asset.fit))
+#
+# data <- fit$data
+# factors <- data[,fit$factors.names]
+# mu.factors <- apply(factors,2,mean)
+# cov.factors <- cov(factors)
+#
+# for (i in 1:numAssets)
+# if (dim(newdata)[1] < length(residuals(fit$asset.fit[[1]])) ){
+#
+#
+# newdata <- data.frame(EDHEC.LS.EQ = rnorm(n=100), SP500.TR = rnorm(n=100) )
+# newdata.mat <- as.matrix(newdata)
+# factor.scenarios <- 0.001
+# names(factor.scenarios) <- "SP500.TR"
+#
+# impliedFactorReturns(factor.scenarios, mu.factors, cov.factors)
+#
+# }
+#
+#
+#
+# }
+#
-
}
\ No newline at end of file
Modified: pkg/FactorAnalytics/man/impliedFactorReturns.Rd
===================================================================
--- pkg/FactorAnalytics/man/impliedFactorReturns.Rd 2013-06-27 16:55:34 UTC (rev 2454)
+++ pkg/FactorAnalytics/man/impliedFactorReturns.Rd 2013-06-27 22:14:44 UTC (rev 2455)
@@ -1,54 +1,53 @@
-\name{impliedFactorReturns}
-\alias{impliedFactorReturns}
-\title{Compute Implied Factor Returns Using Covariance Matrix Approach}
-\usage{
- impliedFactorReturns(factor.scenarios, mu.factors,
- cov.factors)
-}
-\arguments{
- \item{factor.scenarios}{\code{m x 1} vector of factor
- mean returns of scenario. m is a subset of the n, where n
- is risk factors and \code{n > m}.}
-
- \item{mu.factors}{\code{n x 1} vector of factor mean
- returns.}
-
- \item{cov.factors}{\code{n x n} factor covariance
- matrix.}
-}
-\value{
- \code{(n - m) x 1} vector of implied factor returns
-}
-\description{
- Compute risk factor conditional mean returns for a one
- group of risk factors given specified returns for another
- group of risk factors based on the assumption that all
- risk factor returns are multivariately normally
- distributed.
-}
-\details{
- Let \code{y} denote the \code{m x 1} vector of factor
- scenarios and \code{x} denote the \code{(n-m) x 1} vector
- of other factors. Assume that \code{(y', x')'} has a
- multivariate normal distribution with mean \code{(mu.y',
- mu.x')'} and covariance matrix partitioned as
- \code{(cov.yy, cov.yx, cov.xy, cov.xx)}. Then the implied
- factor scenarios are computed as \code{E[x|y] = mu.x +
- cov.xy*cov.xx^-1 * (y - mu.y)}
-}
-\examples{
-# get data
-data(managers.df)
-factors = managers.df[,(7:9)]
-# make up a factor mean returns scenario for factor SP500.TR
-factor.scenarios <- 0.001
-names(factor.scenarios) <- "SP500.TR"
-mu.factors <- mean(factors)
-cov.factors <- var(factors)
-# implied factor returns
-impliedFactorReturns(factor.scenarios,mu.factors,cov.factors)
-}
-\author{
- Eric Zivot and Yi-An Chen.
-}
-
+\name{impliedFactorReturns}
+\alias{impliedFactorReturns}
+\title{Compute Implied Factor Returns Using Covariance Matrix Approach}
+\usage{
+ impliedFactorReturns(factor.scenarios, mu.factors,
+ cov.factors)
+}
+\arguments{
+ \item{factor.scenarios}{m x 1 vector of scenario values
+ for a subset of the n > m risk factors}
+
+ \item{mu.factors}{\code{n x 1} vector of factor mean
+ returns.}
+
+ \item{cov.factors}{\code{n x n} factor covariance
+ matrix.}
+}
+\value{
+ \code{(n - m) x 1} vector of implied factor returns
+}
+\description{
+ Compute risk factor conditional mean returns for a one
+ group of risk factors given specified returns for another
+ group of risk factors based on the assumption that all
+ risk factor returns are multivariately normally
+ distributed.
+}
+\details{
+ Let \code{y} denote the \code{m x 1} vector of factor
+ scenarios and \code{x} denote the \code{(n-m) x 1} vector
+ of other factors. Assume that \code{(y', x')'} has a
+ multivariate normal distribution with mean \code{(mu.y',
+ mu.x')'} and covariance matrix partitioned as
+ \code{(cov.yy, cov.yx, cov.xy, cov.xx)}. Then the implied
+ factor scenarios are computed as \code{E[x|y] = mu.x +
+ cov.xy*cov.xx^-1 * (y - mu.y)}
+}
+\examples{
+# get data
+data(managers.df)
+factors = managers.df[,(7:9)]
+# make up a factor mean returns scenario for factor SP500.TR
+factor.scenarios <- 0.1
+names(factor.scenarios) <- "SP500.TR"
+mu.factors <- mean(factors)
+cov.factors <- var(factors)
+# implied factor returns
+impliedFactorReturns(factor.scenarios,mu.factors,cov.factors)
+}
+\author{
+ Eric Zivot and Yi-An Chen.
+}
+
Modified: pkg/FactorAnalytics/man/predict.TimeSeriesFactorModel.Rd
===================================================================
--- pkg/FactorAnalytics/man/predict.TimeSeriesFactorModel.Rd 2013-06-27 16:55:34 UTC (rev 2454)
+++ pkg/FactorAnalytics/man/predict.TimeSeriesFactorModel.Rd 2013-06-27 22:14:44 UTC (rev 2455)
@@ -2,7 +2,7 @@
\alias{predict.TimeSeriesFactorModel}
\title{predict method for TimeSeriesModel object.}
\usage{
- predict.TimeSeriesFactorModel(fit, ...)
+ predict.TimeSeriesFactorModel(fit, newdata, ...)
}
\arguments{
\item{fit}{"TimeSeriesFactorModel" object created by
More information about the Returnanalytics-commits
mailing list