[Returnanalytics-commits] r2387 - pkg/Meucci/demo
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Jun 20 09:42:39 CEST 2013
Author: xavierv
Date: 2013-06-20 09:42:39 +0200 (Thu, 20 Jun 2013)
New Revision: 2387
Added:
pkg/Meucci/demo/S_FullCodependence.R
Modified:
pkg/Meucci/demo/S_DisplayNormalCopulaCdf.R
Log:
-added script illustrating the concept of co-dependence
Modified: pkg/Meucci/demo/S_DisplayNormalCopulaCdf.R
===================================================================
--- pkg/Meucci/demo/S_DisplayNormalCopulaCdf.R 2013-06-20 07:08:17 UTC (rev 2386)
+++ pkg/Meucci/demo/S_DisplayNormalCopulaCdf.R 2013-06-20 07:42:39 UTC (rev 2387)
@@ -3,7 +3,7 @@
#'
#' @references
#' \url{http://}
-#' See Meucci's script for "S_DisplayNormalCopulaPdf.m"
+#' See Meucci's script for "S_DisplayNormalCopulaCdf.m"
#'
#' @author Xavier Valls \email{flamejat@@gmail.com}
#' @export
Added: pkg/Meucci/demo/S_FullCodependence.R
===================================================================
--- pkg/Meucci/demo/S_FullCodependence.R (rev 0)
+++ pkg/Meucci/demo/S_FullCodependence.R 2013-06-20 07:42:39 UTC (rev 2387)
@@ -0,0 +1,33 @@
+#' This script illustrate the concept of co-dependence, as described
+#' in A. Meucci, "Risk and Asset Allocation", Springer, 2005, Chapter 2.
+#'
+#' @references
+#' \url{http://}
+#' See Meucci's script for "S_DisplayNormalCopulaPdf.m"
+#'
+#' @author Xavier Valls \email{flamejat@@gmail.com}
+#' @export
+
+#############################################################################################################
+### Generate draws
+J = 10000;
+N = 10;
+sig2 = 1;
+
+U = runif( J );
+X = matrix( NaN, J, N );
+
+for( n in 1 : N )
+{
+ a = n / 2;
+ b = 2 * sig2;
+ X[ , n ] = qgamma( U, a, b );
+}
+
+NumBins = round( 10 * log( J ));
+
+
+hist( X[ , 1 ], NumBins, xlab = "X_1");
+plot( X[ , 1 ], X[ , 2 ], xlab = "X_1", ylab = "X_2" );
+hist( X[ , 2 ], NumBins, xlab = "X_2");
+
More information about the Returnanalytics-commits
mailing list