[Returnanalytics-commits] r3769 - pkg/Dowd/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Jul 2 20:23:28 CEST 2015
Author: dacharya
Date: 2015-07-02 20:23:28 +0200 (Thu, 02 Jul 2015)
New Revision: 3769
Modified:
pkg/Dowd/R/PCAVaR.R
Log:
Mistake in example was corrected.
Modified: pkg/Dowd/R/PCAVaR.R
===================================================================
--- pkg/Dowd/R/PCAVaR.R 2015-07-02 18:22:44 UTC (rev 3768)
+++ pkg/Dowd/R/PCAVaR.R 2015-07-02 18:23:28 UTC (rev 3769)
@@ -13,9 +13,9 @@
#' @examples
#'
#' # Computes PCA VaR
-#'
-#' Ra <- rnorm(30)
-#' KernelESEpanechinikovKernel(Ra, .95)
+#' Ra <- matrix(rnorm(4*6),4,6)
+#' position.data <- rnorm(6)
+#' PCAVaR(Ra, position.data, 2, .95)
#'
#' @export
PCAVaR <- function(Ra, position.data, number.of.principal.components, cl){
@@ -40,7 +40,6 @@
# Principal components estimation
a <- svd(return.data) # SVD; provides U and V
index <- n - number.of.principal.components # Establishes how many zero terms on diagonal of S matrix
- print(index)
S.diag <- sort(a$d, decreasing = TRUE)[1:number.of.principal.components] # Creates diagonal for S matrix
S.diag <- diag(S.diag)
S <- matrix(0, min(m, n), min(m, n))
More information about the Returnanalytics-commits
mailing list