Nothing
#' @export
#' @title Some Examples of a Time Circle Model with a Consumer and a Type of Bank
#' @aliases gemIntertemporal_TimeCircle_Bank_1_2
#' @description Some examples of a time circle model with a consumer and a type of bank.
#' These models can be used to solve some intertemporal savings problems.
#'
#' In these example, an np-period-lived consumer gets some payoff (or cash, exhaustible resource etc.) in each period.
#' In each period the consumer can use payoff for consumption, save payoff into bank or get a loan from the bank.
#' The interest rate is given.
#' The consumer has a CES intertemporal utility function and attempts to maximize intertemporal utility by saving and borrowing.
#' @param ... arguments to be passed to the function sdm2.
#' @examples
#' \donttest{
#' #### an example with a 5-period-lived consumer (see Zhang, 2008, section 1.3)
#' np <- 5 # the number of economic periods
#' interest.rate <- 0.1
#' zeta <- (1 + interest.rate)^np # the ratio of repayments to loans
#'
#' n <- np # the number of commodity kinds
#' m <- np + 1 # the number of agent kinds
#'
#' names.commodity <- paste0("payoff", 1:np)
#' names.agent <- c(paste0("bank", 1:np), "consumer")
#'
#' # the exogenous supply matrix.
#' S0Exg <- matrix(NA, n, m, dimnames = list(names.commodity, names.agent))
#' S0Exg[paste0("payoff", 1:np), "consumer"] <- 100 / (1:np)
#'
#' # the output coefficient matrix.
#' B <- matrix(0, n, m, dimnames = list(names.commodity, names.agent))
#' for (k in 1:(np - 1)) {
#' B[paste0("payoff", k + 1), paste0("bank", k)] <- 1
#' }
#' B["payoff1", paste0("bank", np)] <- 1 / zeta
#'
#' dstl.bank <- list()
#' for (k in 1:np) {
#' dstl.bank[[k]] <- node_new(
#' "output",
#' type = "Leontief", a = 1 / (1 + interest.rate),
#' paste0("payoff", k)
#' )
#' }
#'
#' dst.consumer <- node_new(
#' "util",
#' type = "CES", es = 0.5, alpha = 1, beta = prop.table(1:np),
#' paste0("payoff", 1:np)
#' )
#'
#' ge <- sdm2(
#' A = c(dstl.bank, dst.consumer),
#' B = B,
#' S0Exg = S0Exg,
#' names.commodity = names.commodity,
#' names.agent = names.agent,
#' numeraire = "payoff1",
#' ts = TRUE,
#' policy = makePolicyMeanValue(30)
#' )
#'
#' ge$p
#' ge$z
#' ge$D
#' ge$S
#' ge$DV
#' ge$SV
#' growth_rate(ge$p)
#'
#' ####
#' dst.consumer$es <- 0
#'
#' ge <- sdm2(
#' A = c(dstl.bank, dst.consumer),
#' B = B,
#' S0Exg = S0Exg,
#' names.commodity = names.commodity,
#' names.agent = names.agent,
#' numeraire = "payoff1",
#' ts = TRUE,
#' policy = makePolicyMeanValue(30)
#' )
#'
#' ge$p
#' ge$z
#' ge$D
#' ge$S
#' ge$DV
#' ge$SV
#' growth_rate(ge$p)
#' }
gemIntertemporal_TimeCircle_Bank_1_2 <- function(...) sdm2(...)
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.