de---
title: "Using the lre_auto function"
author: "Ulugbek Nuritov"
date: "r Sys.Date()
"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Vignette Title}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
This vignette documents how to use the lre_auto function in the package to solve for a range of linear rational expectations models.
Essentially, the package contains several wrapper functions for objects in the QZ package so as to output solutions to LRE models according to Blanchard and Kahn(1980) or Klein(2000) methods.
The main function to call is lre_auto however there are also 2 specific functions for an autonomous model to directly get either the Klein or the Blanchard and Kahn solutions.
The functions in the package call the coefficient matrices of the linearized difference equations.
To get the dynamic behaviour of a given model it is first necessary to linearize it to obtain the following system of difference equations e.g. $E(x_{t+1}) = A(x_t)$
The functions also require the number of predetermined variables in the system so as to decouple the system follwoing the QZ decomposition such that the non-predetermined variables depend only upon the unstable eigenvalues.
As an example, consider the following initial system:
A <- matrix(c(0.7,0,1.2,0.6363636,1.909091,0.1818182,0,-1,1), byrow=T, nrow=3) x0 <- 0.1 E <- diag(1, nrow=3)
Then the lre_auto will give the Blanchard Kahn solution if E is ommitted in the call. Else it will give the Klein method solution:
sim1 <- lrem::lre_auto(A, n = length(x0)) sim2 <- lrem::lre_auto(A, E, n = length(x0)) sim1 sim2
Then, running the simulate function included in the package as follows and plotting the result gives
out1 <- lrem::simulate_no_shock(sim1[[1]],sim1[[2]],x0,100) plot(out1[,1])
For the Blanchard and Kahn methods' solution and
out2 <- lrem::simulate_no_shock(sim2[[1]],sim2[[2]],x0,100) plot(out1[,1])
For the Klein approach respectively.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.