init_sbetel: Initialize a smoothed BETEL model

Description Usage Arguments Details Value Examples

View source: R/core.R

Description

Initialize a smoothed BETEL model by providing the model defining function g(), the prior generating function prior_fun() and the data y to be used for the estimation of the model. Alternatively ready-made functions can be used (e.g. by setting g = "var" and prior_fun() = "var"). init_sbetel() returns a list that defines the model and can be passed on either to eval_sbetel() or est_sbetel().

#' @param y A data matrix. Input for g() below. E.g. for g = "var" this would be a T x k matrix with T observations of k variables.

Usage

1
2
3
4
5
6
7
8
9
init_sbetel(
  y,
  g = "var",
  prior_fun = "var",
  bw = "auto",
  initial = NULL,
  args = list(),
  verbose = TRUE
)

Arguments

g

A function of the form g(th, y, args) defining the model. Inputs should include a numerical parameter vector th, a data matrix y and optional further arguments through a list called args. Output shoud be a numerical matrix with its columns corresponding to the sample moment conditions of the model. Defaults to "var" in which case a ready-made function for vector autoregressive models is used. For more, see details.

prior_fun

A function that defines the prior data generating process. The only inputs should be the model generated by init_sbetel(). Further arguments to this function should be passed through model$args. Output should be a list with to elements called yy for dependent variables and xx for explanatory variables or a data matrix with the same number of columns as y, depending on the model.

bw

Integer (>= 0). The bandwidth parameter controlling smoothing of the moment conditions. Defaults to "auto" in which case the optimal parameter value is chosen according to bwAndrews(). For highly autocorrelated moment conditions higher values of bw are needed, while for independent data this should be set to zero, in which case no smoothing takes place. For more, see details.

initial

A function that returns an initial estimate for the parameters and their covariance matrix as a list with two elements called th and cov. By default OLS estimates are used and should be used whenever possible.

args

A list containing optional further arguments to g() and prior_fun(). For a var model, the lag length can be set for example by args = list(p = 5). For more, see details.

verbose

Logical. Defaults to TRUE in which case messages are produced.

Details

TBA

Value

init_sbetel() returns a list that defines a sbetel model and can be passed on to eval_sbetel() or est_sbetel().

Examples

1
2
3
4
## Not run: 
model <- init_sbetel(y = y, bw = 1, args = list(p = 2))

## End(Not run)

jetroant/sbetel documentation built on Oct. 20, 2020, 1:11 a.m.