Skip to content

Commit

Permalink
Internal release, work on news & readme, prelim logLik
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikolas Kuschnig committed Aug 30, 2019
1 parent 947a5c8 commit 0dfcce2
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 13 deletions.
67 changes: 67 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# v0.1.6, Internal Release 1

- Prepare for first minor release
- Provide several standard methods for objects generated with *BVAR*
- `predict()` for ex-post forecasts and generating quantiles
- `irf()` / `fevd()` for ex-post irfs, fevds and generating quantiles
- `fitted()`, `residuals()`, `coef()` and `vcov()`
- `density()` as shorthand for calling `density()` on hyperparameters
- Added `print()` methods for intermediate objects
- Includes `bv_minnesota`, `bv_metropolis` and method outputs
- Reworked plotting
- `plot.bvar()` now supports types, subsets and multiple chains
- `bv_plot_trace()` and `bv_plot_density()` are now deprecated
- `density()` offers a plot method
- Both can be replaced by `plot.bvar()`, incl. plotting of multiple chains
- Plots of `bvar_fcast` and `bvar_irf` have been changed
- The preferred way of calling is now: `plot(x$irf)` or `plot(irf(x))`
- The previous `bv_plot_irf(x)` is now deprecated
- Confidence bands are now set in `predict()` / `irf()` instead
- Added plot methods for `bvar_resid` and `bvar_density`
- Added `sign_lim` to set maximum number of sign restriction draws
- Prior construction has been standardised further
- `alpha`, `lambda` and dummy-priors are quite alike, `psi` has been aligned
- `bv_mn()` may be called with a numeric vector for `alpha` and/or `lambda`
- Documentation has been improved
- Related functions are now documented in joint
- Details on priors have been added
- Added less concise aliases for `bv_mh()` and `bv_mn()`
- `bv_metropolis()` and `bv_minnesota()`
- Fixed bugs related to single confidence bands at 0.5
- Saved `fred_qd` with format version 2, lowering R dependency to (>= 3.3.0)
- Added *vars* to suggests for shared methods, import is bypassed


# v0.1.5, CRAN Update 1

- Tried to clarify licensing terms with the Federal Reserve
- Some copyrighted series may have to be removed
- Subset the dataset to only include variables in public domain for now


# v0.1.4, JSS Submission

- Fix addition of prior pdfs to ML
- `alpha` needs an sd parameter
- `psi` now needs proper shape and scale parameters
- Add normalising constant
- Add lines to all density plots (when supplied via ellipsis)
- Add documentation on using `scale_hess` as a vector
- Add two pre-constructed dummy priors `bv_soc()` and `bv_sur()`
- Further split up calculation of marginal likelihood


# v0.1.3, CRAN Submission 2

- Updated DESCRIPTION with linked DOI
- Change `\dontrun{}` examples to `\donttest{}`
- Improve examples for plotting and printing
- Small fix to bounds in `plot_hyper()`
- R CMD check --as-cran: No errors or warnings, one note (New submission)


# v0.1.3, CRAN Submission 1

- Updated references with links via DOI
- Added examples to `print` and `plot` methods
- R CMD check --as-cran: No errors or warnings, one note (New submission)
24 changes: 24 additions & 0 deletions R/94_logLik.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Issues:
# - not vectorised
# - additional dependency
# - maybe use mvtnorm instead of MASS
# - go GPL on their ass and use the functions directly
# - Write own vectorised version
# - no checks
#' @noRd
logLik.bvar <- function(x, ...) {

Y <- x[["meta"]][["Y"]]
X <- x[["meta"]][["X"]]
N <- x[["meta"]][["N"]]
beta <- coef(x, 0.5)
sigma <- vcov(x, 0.5)

ll <- 0
for(i in seq_len(N)) {
ll <- ll + mvtnorm::dmvnorm(Y[i, ], X[i, ] %*% beta, sigma, log = TRUE)
}

}

isSymmetric.bvar_vcovs <- function(object, ...) {isSymmetric.matrix(object, ...)}
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ BVAR

Toolkit for the estimation of hierarchical Bayesian VARs. Implements prior selection for conjugate priors in the fashion of Giannone, Lenza and Primiceri (2015), accounting for uncertainty about prior hyperparameters. Allows for the computation of impulse responses as well as forecasts based on draws of coefficients from their respective posterior distribution.

The main function to perform hierarchical Bayesian VAR estimation is `bvar()`, which includes settings regarding the lag length, the number of iterations to run and several others that are constructed via helpter functions.
The main function to perform hierarchical Bayesian VAR estimation is `bvar()`, which includes settings regarding the lag length, the number of iterations to run and several others that are constructed via helpter functions. The included FRED-QD dataset (McCracken and Ng, 2016) can be accessed using `data("fred_qd")` and may be used to investigate a variety of economic issues.

The function `bv_priors()` is used for settings regarding the priors; i.e. which to include and how. Other helper functions functions (see `bv_mn()`, `bv_dummy()`) may be used to set up the Minnesota prior or other conjugate dummy observation priors.
The helper function `bv_mh()` provides settings regarding the Metropolis-Hastings step. It allows scaling the Hessian matrix that is used to generate hyperparameters, thus allowing fine-tuning of the acceptance rate.
Further options regarding the computation of impulse responses and forecasts can be accessed via the functions `bv_irf()` and `bv_fcast()`. Adjustments to the horizon can be set as well as the type of identifcation of shocks for the impulse
responses.
Further options regarding the computation of impulse responses and forecasts can be accessed via the functions `bv_irf()` and `bv_fcast()`. Adjustments to the horizon can be set as well as the type of identifcation of shocks for the impulse responses.

The generated `bvar` and contained `bvar_fcast` and `bvar_irf` objects can be further analysed using a variety of methods, including `summary()`, `plot()`, `fitted()`, `residuals()`, `coef()`, `vcov()`, `predict()`, `irf()`, `fevd()` and `density()`.

### References

Expand Down
22 changes: 12 additions & 10 deletions cran-comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,28 @@

*Under Construction*


# v0.1.6, Internal Release 1

- Prepare for first minor release
- Provide several standard methods for objects generated with *BVAR*
- `summary()` **To-Do**
- `predict()` for ex-post forecasts and generating quantiles
- `irf()` / `fevd()` for ex-post irfs and fevds and generating quantiles
- `irf()` / `fevd()` for ex-post irfs, fevds and generating quantiles
- `fitted()`, `residuals()`, `coef()` and `vcov()`
- `density()` to summarise and plot hyperparameters
- `density()` as shorthand for calling `density()` on hyperparameters
- Added `print()` methods for intermediate objects
- Includes `bv_minnesota`, `bv_metropolis` and method outputs
- Reworked plotting
- `plot.bvar()` now supports several types
- `plot.bvar()` now supports types, subsets and multiple chains
- `bv_plot_trace()` and `bv_plot_density()` are now deprecated
- `density()` offers a plot method
- Both can be replaced by `plot.bvar()`, incl. plotting of multiple chains
- Plots of fcasts and irfs have been changed
- Plots of `bvar_fcast` and `bvar_irf` have been changed
- The preferred way of calling is now: `plot(x$irf)` or `plot(irf(x))`
- The previous `bv_plot_irf(x)` is still supported, however
- The previous `bv_plot_irf(x)` is now deprecated
- Confidence bands are now set in `predict()` / `irf()` instead
- Added plot methods for `bvar_resid` and `bvar_density`
- Added option to set maximum number of draws for sign restrictions
- Added `sign_lim` to set maximum number of sign restriction draws
- Prior construction has been standardised further
- `alpha`, `lambda` and dummy-priors are quite alike, `psi` has been aligned
- `bv_mn()` may be called with a numeric vector for `alpha` and/or `lambda`
Expand All @@ -30,9 +34,7 @@
- `bv_metropolis()` and `bv_minnesota()`
- Fixed bugs related to single confidence bands at 0.5
- Saved `fred_qd` with format version 2, lowering R dependency to (>= 3.3.0)
- Added *vars* and *coda* to suggests
- Shared methods with *vars*, import is bypassed
- Upcoming use of *coda* methods **To-Do**
- Added *vars* to suggests for shared methods, import is bypassed


# v0.1.5, CRAN Update 1
Expand Down

0 comments on commit 0dfcce2

Please sign in to comment.