R/CD_A.R

Defines functions CD_A

Documented in CD_A

#' @export

CD_A <- function(alpha, Beta, p) {
  # computing Cobb-Douglas demand structure matrix
  if (!is.matrix(Beta)) Beta <- cbind(Beta)

  if (is.numeric(Beta) && any(abs(colSums(Beta) - 1) > 10^-10)) {
    stop("Li: colSum(Beta)~=1, CD_A")
  }

  A <- dg(1 / p) %*% Beta %*% dg(apply((dg(1 / p) %*% Beta)^(-Beta), 2, prod) %*% dg(1 / alpha))
  A
}

Try the CGE package in your browser

Any scripts or data that you put into this service are public.

CGE documentation built on July 8, 2020, 5:16 p.m.