[Vars-commits] r66 - in pkg: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Feb 4 02:15:45 CET 2010


Author: matthieu
Date: 2010-02-04 02:15:45 +0100 (Thu, 04 Feb 2010)
New Revision: 66

Modified:
   pkg/R/causality.R
   pkg/man/causality.Rd
Log:
Add arg vcov. in causality for robust vcov

Modified: pkg/R/causality.R
===================================================================
--- pkg/R/causality.R	2009-12-12 16:02:46 UTC (rev 65)
+++ pkg/R/causality.R	2010-02-04 01:15:45 UTC (rev 66)
@@ -1,5 +1,5 @@
 "causality" <-
-function(x, cause = NULL){
+function(x, cause = NULL, vcov.=NULL){
   if(!(class(x)=="varest")){
     stop("\nPlease provide an object of class 'varest', generated by 'var()'.\n")
   }
@@ -39,7 +39,8 @@
   ##
   ## Granger-causality
   ##
-  sigma.pi <- vcov(xMlm)
+  sigma.pi  <- if (is.null(vcov.)) vcov(xMlm)
+        else if (is.function(vcov.)) vcov.(xMlm) else vcov.
   df1 <- p * length(y1.names) * length(y2.names)
   df2 <- K * obs - length(PI)#K^2 * p - detcoeff
   STATISTIC <- t(R %*% PI.vec) %*% solve(R %*% sigma.pi %*% t(R)) %*% R %*% PI.vec / N

Modified: pkg/man/causality.Rd
===================================================================
--- pkg/man/causality.Rd	2009-12-12 16:02:46 UTC (rev 65)
+++ pkg/man/causality.Rd	2010-02-04 01:15:45 UTC (rev 66)
@@ -12,7 +12,7 @@
 }
 
 \usage{
-causality(x, cause = NULL)
+causality(x, cause = NULL, vcov.=NULL)
 }
 
 \arguments{
@@ -20,7 +20,9 @@
     \command{VAR()}.} 
   \item{cause}{A character vector of the cause variable(s). If not set,
     then the variable in the first column of \code{x$y} is used as cause
-    variable and a warning is printed.}   
+    variable and a warning is printed.}   
+  \item{vcov.}{a specification of the covariance matrix of the estimated coefficients. This can be
+    specified as a matrix or as a function yielding a matrix when applied to \code{x}.}
 }
 
 \details{
@@ -64,7 +66,12 @@
     \frac{1}{2}K(K + 1))} and is defined such that for any symmetric
   \eqn{(K \times K)} matrix A, \eqn{vec(A) = D_K vech(A)} holds. The
   test statistic \eqn{\lambda_W} is asymptotically distributed as
-  \eqn{\chi^2(N)}.   
+  \eqn{\chi^2(N)}.
+  
+  Fot the Granger causality test, a robust covariance-matrix estimator can be 
+  used through argument \code{vcov.} It can be either a pre-computed matrix or
+  a function for extracting the covariance matrix. See \code{\link[sandwich]{vcovHC}}
+  from package \pkg{sandwich} for duther details.
 }
 
 \value{



More information about the Vars-commits mailing list