[Highfrequency-commits] r36 - in pkg/highfrequency: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Aug 18 00:05:37 CEST 2012


Author: jonathan
Date: 2012-08-18 00:05:37 +0200 (Sat, 18 Aug 2012)
New Revision: 36

Modified:
   pkg/highfrequency/R/realized.R
   pkg/highfrequency/man/heavyModel.Rd
   pkg/highfrequency/man/spotVol.rd
Log:
spotvol,heavy manual updates, heavymodel adaptation bounds

Modified: pkg/highfrequency/R/realized.R
===================================================================
--- pkg/highfrequency/R/realized.R	2012-08-15 00:41:18 UTC (rev 35)
+++ pkg/highfrequency/R/realized.R	2012-08-17 22:05:37 UTC (rev 36)
@@ -3994,14 +3994,15 @@
   ci   = rep(0,dim(ui)[2]);  
   
   x = try(optim( par = startingvalues, fn = heavy_likelihood,
-                 data=data, p=p, q=q,backcast=backcast,UB=UB,LB=LB, compconst = compconst ) ); # ADJUST maxit ?!!
+                 data=data, p=p, q=q,backcast=backcast,UB=UB,LB=LB, lower=LB,upper=UB, compconst = compconst ) ); # ADJUST maxit ?!!
+  
   #x = try(constrOptim( theta = startingvalues, f = heavy_likelihood, 
   #                     grad = NULL,
   #                     ui = ui, 
   #                     ci = ci, 
   #                     data=data, p=p, q=q,backcast=backcast,UB=UB,LB=LB, compconst = compconst));
   
-  if( class(x)=="try-error"){
+  if( class(x) == "try-error" ){
     print("Error in likelihood optimization")
     print(x)
   }else{
@@ -4060,13 +4061,13 @@
     end   = start + sum(q>=i) -1; # How many non-zero params in this loop?
     B[[i]] = matrix(rep(0,K^2),ncol=2); 
     B[[i]][q >= i] = paramsvector[start:end];
-    start  = end+1;   
+    start  = end + 1;   
   }#End loop over number of lags for cond variances
   
   return( list(O,A,B) ) 
 }  
 
-heavy_likelihood = function(parameters, data, p, q, backcast, LB, UB, foroptim=TRUE, compconst=FALSE ){ 
+heavy_likelihood = function( par, data, p, q, backcast, LB, UB, foroptim=TRUE, compconst=FALSE ){ 
   # Get the required variables
   # p is Max number of lags for innovations 
   # q is Max number of lags for conditional variances
@@ -4077,7 +4078,7 @@
   maxp = max(p); maxq=max(q);
   
   # Get the parameters:
-  x = transformparams( parameters, p=p, q=q );
+  x = transformparams( par, p=p, q=q );
   if( compconst ){ O = x[[1]]; } 
   A = x[[2]]; B = x[[3]]; 
   # Compute constant in case it needn't to be optimized:

Modified: pkg/highfrequency/man/heavyModel.Rd
===================================================================
--- pkg/highfrequency/man/heavyModel.Rd	2012-08-15 00:41:18 UTC (rev 35)
+++ pkg/highfrequency/man/heavyModel.Rd	2012-08-17 22:05:37 UTC (rev 36)
@@ -38,21 +38,22 @@
 
 \section{Details}{ 
 See vignette.
+NOTE: The implementation of the heavyModel is not completely finished. For the moment only bound constraints on the parameters are imposed in the optimization. Future developments also include outputting standard errors, and a c-implementation of the likelihood function to speed up the QML estimation.
 }
 
 \value{ 
 A list with the following values:
 (i) loglikelihood: The log likelihood evaluated at the parameter estimates.
-(ii) likelihoods: a vector of length T containing the log likelihoods per day.
-(iii) condvar: a (K x T) containing the conditional variances
+(ii) likelihoods: an xts object of length T containing the log likelihoods per day.
+(iii) condvar: a (T x K) xts object containing the conditional variances
 (iv) estparams: a vector with the parameter estimates. The order in which the
 parameters are reported is as follows: First the estimates for omega then the
 estimates for the non-zero alpha's with the most recent lags first in case max(p) > 1,
 then the estimates for the non-zero beta's with the most recent lag first in case
 max(q) > 1.
+(v) convergence: an integer code indicating the successfulness of the optimization. See \verb{optim} for more information.
 }
 
-
 \references{
 Shephard, N. and K. Sheppard (2010). Realising the future: forecasting with high
 frequency based volatility (heavy) models. Journal of Applied Econometrics 25,

Modified: pkg/highfrequency/man/spotVol.rd
===================================================================
--- pkg/highfrequency/man/spotVol.rd	2012-08-15 00:41:18 UTC (rev 35)
+++ pkg/highfrequency/man/spotVol.rd	2012-08-17 22:05:37 UTC (rev 36)
@@ -5,7 +5,7 @@
 Spot volatility estimation}
 
 \description{
-Function returns an estimate of the volatility \eqn{\sigma_{t,i}} of equispaced high-frequency returns \eqn{r_{t,i}} (read: the \eqn{i}th return
+Function returns an estimate of the standard deviation \eqn{\sigma_{t,i}} of equispaced high-frequency returns \eqn{r_{t,i}} (read: the \eqn{i}th return
 on day \eqn{t}). The underlying assumption is that, in the absence of price jumps, high-frequency returns
 are normally distributed with mean zero and standard deviation \eqn{\sigma_{t,i}}, where 
 the standard deviation is the product between a deterministic periodic factor \eqn{f_{i}} (identical for every day in the sample)
@@ -38,7 +38,7 @@
    \item{on}{ character, indicating the time scale in which "k" is expressed. Possible values are: "secs", "seconds", "mins", "minutes","hours".}
    \item{k}{ positive integer, indicating the number of periods to aggregate over. E.g. to aggregate a 
    xts object to the 5 minute frequency set k=5 and on="minutes".}
-   \item{dummies}{ boolean, in case it is TRUE, the parametric estimator of periodic volatility specifies the periodicity function as the sum of dummy variables corresponding to each intraday period. 
+   \item{dummies}{ boolean, in case it is TRUE, the parametric estimator of periodic standard deviation  specifies the periodicity function as the sum of dummy variables corresponding to each intraday period. 
    If it false, the parametric estimator uses the Flexible Fourrier specification. FALSE by default.}
    \item{P1}{ is a positive integer valued parameter that corresponds to the number of cosinus terms used in the flexible fourrier specification for the periodicity function, see Andersen et al. (1997) for details.}
    \item{P2}{ is a positive integer valued parameter that corresponds to the number of sinus terms used in the flexible fourrier specification for the periodicity function, see Andersen et al. (1997) for details.}
@@ -47,8 +47,7 @@
 }
 
 \details{
-Returns an xts object with first column equal to the high-frequency return series, second column is the estimated volatility, third column is 
-the daily volatility factor and, finally, the fourth column is the periodic component. 
+Returns an xts object with first column equal to the high-frequency return series, second column is the estimated standard deviation, third column is the daily standard deviation factor and, finally, the fourth column is the periodic component. 
 }
 
 \references{



More information about the Highfrequency-commits mailing list