Time Series and Prediction - Vector of GARCH Parameter - Statistics Assignment Help

Download Solution Order New Solution
Internal Code: 1ABHGJ

Statistics Assignment Help

Task: 1 Write a function in R called “my.garch11.filter” to compute the 1-step ahead conditional variance of a GARCH(1,1) model as well as the log-likelihood. The GARCH(1,1) conditional variance is given by Statistics for t = 1 to T. To start the recursion ?21 is set equal to the sample variance of the time series {Yt}. The log-likelihood is defined Statistics The function “my.garch11.filter
  • requires as input (in this order) (a) vector containing the time series data Y1,...,YT (b) vector of GARCH(1,1) parameter (?,?,?)/ (in this order)
  • returns as output a list containing (a) (b) sig2: z: vector of vector of GARCH(1,1) GARCH(1,1) 1-step standardized conditional variances innovations zt = Yt/??t 2for ?t 2t = 1,...,T
for t = 1,...,T (c) loglik: scalar log-likelihood
  1. Write a function in R called “my.garch11.objective” to compute the the GARCH(1,1) objective function to be minimized numerically by the R optimizer. The function “my.garch11.objective
  • requires as inputs (in this order) (a) vector containing the time series data Y1,...,YT (b) vector of GARCH(1,1) filter parameters (?,?,?)/ (in this order)
  • returns as output a the negative of the log-likelihood
The function has to perform these checks on the input parameter (a) check if all the parameters of the param vector are finite (check the function is.finite in R) (b) check if the parameters of the GARCH(1,1) satisfies the following constraints: ? > 0, ? > 0, ? > 0, ? + ? < 1 1 log?t 2? 12 If the vector of parameters fails to satisfy any of these conditions then the function should return “infinity” (Inf).
  1. Write a function in R called “my.garch11.mle” to estimate the GARCH(1,1) parameters using the nlminb optimizer in R. The function “my.garch11.mle
  • requires as inputs (in this order) (a) vector containing the time series data Y1,...,YT (b) a vector of initial values of the GARCH(1,1) parameter (?,?,?)/ (in this order)
  • returns as output a vector containing the maximum likelihood estimate of the GARCH(1,1) parameters
The function “my.garch11.mle” has to minimise the objective function “my.garch11.objective” using the nlminb routine. When calling the nlminb routine makes sure that: (a) You set the lower and upper bound of all the GARCH(1,1) parameters, respectively, to 10-4 and 1 (b) You start the minimization from the initial value provided by the function  It is highly recommended to check the help page of the nlminb function including the examples to understand how this function precisely works.
  1. Write a function in R called “my.garch11.stderr” to estimate the GARCH(1,1) standarderrors using numerical second order derivatives. The function “my.garch11.stderr
  • requires as inputs (in this order)
  1.  vector containing the time series data Y1,...,YT
  2. vector of containing the MLE estimates of the GARCH(1,1) parameters (?,?,?)/(in this order)
  3.  a scalar parameter h which is the step size used for the numerical approximation of the Hessian
  • returns as output the vector of standard errors of the GARCH(1,1) parameters
The standard errors are computed using the asymptotic variance covariance matrix of the ML estimator based on the Hessian of the log-likelihood, that is, ?Yar(ˆ?)=[?HT(ˆ?)]-1 where HT(ˆ?) is the Hessian evaluated at ˆ?. The Hessian HT(ˆ?) is approximated numerically using finite differences. Let ? be defined as ˆ?h where ˆ? is the ML estimator and h is the numerical step size. Let D be a 3×3 dimensional diagonal matrix whose diagonal is equal to ?. Let ei denote a 3 dimensional vector with 1 in position i and zero otherwise. Then, the (i, j) entry of Ht(ˆ?) is approximated as Statistics where ?(1), ?(2), ?(3), ?(4) are defined as Statistics Test Code The following code can be used to test the functions above. This is also the code that is used to evaluate the accuracy of the submission. 1 library(tseries) 2 library(datasets) 3 4 # German stock market index 5 DAX <- as.vector(EuStockMarkets[,1]) 6 7 ret <- diff(log(DAX))*100 8 9 plot(ret) 10 acf (abs(ret) , ylim=c(-0.2,1)) 11 12 # 1) garch(1,1) filter 13 param <- c( var(ret)*(1-0.95) , 0.05 , 0.90 ) 14 15 garch11 <- my.garch11.filter(ret,param) 16 17 plot( ret , lwd=1 ) 18 lines( 1.96*sqrt(garch11$sig2) , lwd=3 , col=’red’ , t=’l’ ) 19 lines( -1.96*sqrt(garch11$sig2) , lwd=3 , col=’red’ , t=’l’ ) 20 21 qqnorm( garch11$z , col=’red’ ) 22 qqline( garch11$z ) 23 24 cat(’log-likelihood:’,garch11$loglik) 25 26 # 2) garch(1,1) objective function for estimation 27 loglik.good <- my.garch11.objective(ret,param) 28 loglik.bad <- my.garch11.objective(ret,c(var(ret),0.25,0.9)) 29 30 # 3) garch(1,1) estimation 31 param.mle <- my.garch11.mle(ret,param) 32 param.bench <- garch(ret, order = c(1,1))$coef 33 34 # estimates are close but not be exactly the same. 35 # the numerical routines that maximise the likelihood use different algorithms 36 cbind( param.mle , param.bench ) 37 38 # the min negative log likelihoods should be very close 39 print( c(my.garch11.objective(ret,param.mle),my.garch11.objective(ret,param.bench)) ) 40 41 # fitte values 42 garch11.mle <- my.garch11.filter(ret,param.mle) 43 plot( sqrt(252*garch11.mle$sig2) , lwd=3 , col=’red’ , t=’l’ ) 44 45 # 4) garch(1,1) inference 46 se.mle <- my.garch11.stderr(ret,param.mle,0.01) 47 se.bench <- sqrt(diag(garch(ret, order = c(1,1))$vcov)) 48 49 # the standard errors should be of the same order of magnitude but differ 50 # as the variance covariance matrix estimators of the two garch routines 51 # are different 52 cbind( se.mle , se.bench ) 53 54 # coefficient table 55 t.val = param.mle/se.mle 56 matcoef = cbind(param.mle, se.mle, t.val, 2*(1-pnorm(abs(t.val)))) 57 dimnames(matcoef) = list(c(’omega’,’alpha’,’beta’), c(" Estimate"," Std. Error", 58 " t value", "Pr(>|t|)")) 59 cat("\nCoefficient(s):\n") 60 printCoefmat(matcoef, digits = 3, signif.stars = TRUE)
This Statistics Assignment has been solved by our Statistics experts at My Uni Paper. Our Assignment Writing Experts are efficient to provide a fresh solution to this question. We are serving more than 10000+ Students in Australia, UK & US by helping them to score HD in their academics. Our Experts are well trained to follow all marking rubrics & referencing style.

Get It Done! Today

Country
Applicable Time Zone is AEST [Sydney, NSW] (GMT+11)
+

Every Assignment. Every Solution. Instantly. Deadline Ahead? Grab Your Sample Now.