[Highfrequency-commits] r32 - pkg/highfrequency/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Aug 13 02:52:22 CEST 2012
Author: jonathan
Date: 2012-08-13 02:52:22 +0200 (Mon, 13 Aug 2012)
New Revision: 32
Modified:
pkg/highfrequency/R/realized.R
Log:
comments kris update: heavyModel constrOptim, this version contains an error, to be resolved..
Modified: pkg/highfrequency/R/realized.R
===================================================================
--- pkg/highfrequency/R/realized.R 2012-08-12 23:05:25 UTC (rev 31)
+++ pkg/highfrequency/R/realized.R 2012-08-13 00:52:22 UTC (rev 32)
@@ -3992,15 +3992,17 @@
# Set constraints:
KKK = length(startingvalues);
ui = diag(rep(1,KKK)); #All parameters should be larger than zero, add extra constraints with rbind...
- ci = matrix(rep(0,dim(ui)[2]),ncol=1);
+ 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 ?!!
- # x = 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 );
+ # x = try(optim( par = startingvalues, fn = heavy_likelihood,
+ # data=data, p=p, q=q,backcast=backcast,UB=UB,LB=LB, compconst = compconst ) ); # ADJUST maxit ?!!
+ x = try(constrOptim( theta = startingvalues, f = heavy_likelihood,
+ grad = NULL,
+ ui = ui,
+ ci = ci,
+ method = "L-BFGS-B",
+ data=data, p=p, q=q,backcast=backcast,UB=UB,LB=LB, compconst = compconst));
-
if( class(x)=="try-error"){
print("Error in likelihood optimization")
print(x)
@@ -4014,12 +4016,14 @@
loglikelihood = x$value;
# Get the list with: total-log-lik, daily-log-lik, condvars
- xx = heavy_likelihood(parameters = estparams, data=data, p=p, q=q, backcast=backcast, LB=LB, UB=UB, foroptim=FALSE, compconst = compconst);
+ xx = heavy_likelihood(par = estparams, data=data, p=p, q=q, backcast=backcast, LB=LB, UB=UB, foroptim=FALSE, compconst = compconst);
xx$estparams = estparams;
xx$convergence = x$convergence
return(xx)
}
+
+
transformparams = function( p, q, paramsvector ){
K = dim(p)[1];
pmax = max(p); qmax = max(q); # Max number of lags for innovations and cond vars
More information about the Highfrequency-commits
mailing list