FCVARlikeGrid {FCVAR} | R Documentation |
Grid Search to Maximize Likelihood Function
Description
FCVARlikeGrid
performs a grid-search optimization
by calculating the likelihood function
on a grid of candidate parameter values.
This function evaluates the likelihood over a grid of values
for c(d,b)
(or phi
).
It can be used when parameter estimates are sensitive to
starting values to give an approximation of the global maximum that can
then be used as the starting value in the numerical optimization in
FCVARestn
.
plot.FCVAR_grid
plots the likelihood function from FCVARlikeGrid
.
Usage
FCVARlikeGrid(x, k, r, opt)
Arguments
x |
A matrix of variables to be included in the system. |
k |
The number of lags in the system. |
r |
The cointegrating rank. |
opt |
An S3 object of class |
Value
An S3 object of type FCVAR_grid
containing the optimization results,
including the following parameters:
params
A vector
params
ofd
andb
(andmu
if level parameter is selected) corresponding to a maximum over the grid ofc(d,b)
orphi
.dbHatStar
A vector of
d
andb
corresponding to a maximum over the grid ofc(d,b)
orphi
.muHatStar
A vector of the optimal
mu
if level parameter is selected.Grid2d
An indicator for whether or not the optimization is conducted over a 2-dimensional parameter space, i.e. if there is no equality restriction on
d
andb
.dGrid
A vector of the grid points in the parameter
d
, after any transformations for restrictions, if any.bGrid
A vector of the grid points in the parameter
b
, after any transformations for restrictions, if any.dGrid_orig
A vector of the grid points in the parameter
d
, in units of the fractional integration parameter.bGrid_orig
A vector of the grid points in the parameter
b
, in units of the fractional integration parameter.like
The maximum value of the likelihood function over the chosen grid.
k
The number of lags in the system.
r
The cointegrating rank.
opt
An S3 object of class
FCVAR_opt
that stores the chosen estimation options, generated fromFCVARoptions()
.
Note
If opt$LocalMax == 0
, FCVARlikeGrid
returns the parameter values
corresponding to the global maximum of the likelihood on the grid.
If opt$LocalMax == 1
, FCVARlikeGrid
returns the parameter values for the
local maximum corresponding to the highest value of b
. This
alleviates the identification problem mentioned in Johansen and
Nielsen (2010, section 2.3).
References
Johansen, S. and M. Ø. Nielsen (2010). "Likelihood inference for a nonstationary fractional autoregressive model," Journal of Econometrics 158, 51-66.
See Also
FCVARoptions
to set default estimation options.
plot.FCVAR_grid
plots the likelihood function from FCVARlikeGrid
.
Other FCVAR auxiliary functions:
FCVARforecast()
,
FCVARsimBS()
,
FCVARsim()
,
FracDiff()
,
plot.FCVAR_grid()
Examples
# Restrict equality of fractional parameters.
opt <- FCVARoptions()
opt$dbStep1D <- 0.2 # Coarser grid for plotting example.
opt$dbMin <- c(0.01, 0.01) # Set lower bound for d,b.
opt$dbMax <- c(2.00, 2.00) # Set upper bound for d,b.
opt$constrained <- 0 # impose restriction dbMax >= d >= b >= dbMin ? 1 <- yes, 0 <- no.
opt$restrictDB <- 1 # impose restriction d=b ? 1 <- yes, 0 <- no.
opt$progress <- 2 # Show progress report on each value of b.
x <- votingJNP2014[, c("lib", "ir_can", "un_can")]
likeGrid_params <- FCVARlikeGrid(x, k = 2, r = 1, opt)
plot(likeGrid_params)
# Linear restriction on fractional parameters.
opt <- FCVARoptions()
opt$dbStep1D <- 0.2 # Coarser grid for plotting example.
opt$dbMin <- c(0.01, 0.01) # Set lower bound for d,b.
opt$dbMax <- c(2.00, 2.00) # Set upper bound for d,b.
opt$constrained <- 0 # impose restriction dbMax >= d >= b >= dbMin ? 1 <- yes, 0 <- no.
opt$restrictDB <- 0 # impose restriction d=b ? 1 <- yes, 0 <- no.
# Impose linear restriction on d and b:
opt$R_psi <- matrix(c(2, -1), nrow = 1, ncol = 2)
opt$r_psi <- 0.5
opt$progress <- 2 # Show progress report on each value of b.
x <- votingJNP2014[, c("lib", "ir_can", "un_can")]
likeGrid_params <- FCVARlikeGrid(x, k = 2, r = 1, opt)
plot(likeGrid_params)
# Constrained 2-dimensional optimization.
# Impose restriction dbMax >= d >= b >= dbMin.
opt <- FCVARoptions()
opt$dbStep1D <- 0.2 # Coarser grid for plotting example.
opt$dbStep2D <- 0.2 # Coarser grid for plotting example.
opt$dbMin <- c(0.01, 0.01) # Set lower bound for d,b.
opt$dbMax <- c(2.00, 2.00) # Set upper bound for d,b.
opt$constrained <- 1 # impose restriction dbMax >= d >= b >= dbMin ? 1 <- yes, 0 <- no.
opt$restrictDB <- 0 # impose restriction d=b ? 1 <- yes, 0 <- no.
opt$progress <- 2 # Show progress report on each value of b.
x <- votingJNP2014[, c("lib", "ir_can", "un_can")]
likeGrid_params <- FCVARlikeGrid(x, k = 2, r = 1, opt)
# Unconstrained 2-dimensional optimization.
opt <- FCVARoptions()
opt$dbStep1D <- 0.1 # Coarser grid for plotting example.
opt$dbStep2D <- 0.2 # Coarser grid for plotting example.
opt$dbMin <- c(0.01, 0.01) # Set lower bound for d,b.
opt$dbMax <- c(2.00, 2.00) # Set upper bound for d,b.
opt$constrained <- 0 # impose restriction dbMax >= d >= b >= dbMin ? 1 <- yes, 0 <- no.
opt$restrictDB <- 0 # impose restriction d=b ? 1 <- yes, 0 <- no.
opt$progress <- 2 # Show progress report on each value of b.
x <- votingJNP2014[, c("lib", "ir_can", "un_can")]
likeGrid_params <- FCVARlikeGrid(x, k = 2, r = 1, opt)