| Type: | Package | 
| Title: | Divisia Monetary Aggregates Index | 
| Version: | 0.5.0 | 
| Author: | Muhammad Yaseen [aut, cre], Ahmad Nadeem [aut, ctb] | 
| Maintainer: | Muhammad Yaseen <myaseen208@gmail.com> | 
| Description: | Functions to calculate Divisia monetary aggregates index as given in Barnett, W. A. (1980) (<doi:10.1016/0304-4076(80)90070-6>). | 
| Depends: | R (≥ 3.1) | 
| Imports: | dplyr, magrittr, ggplot2, stringr, tibble, tidyr | 
| License: | GPL-2 | 
| URL: | https://github.com/myaseen208/dmai/, https://myaseen208.com/dmai/ | 
| Encoding: | UTF-8 | 
| RoxygenNote: | 7.3.1 | 
| Note: | School of Mathematical and Statistical Sciences, Clemson University, Clemson, South Carolina, USA. | 
| Suggests: | testthat | 
| NeedsCompilation: | no | 
| Packaged: | 2024-03-23 23:26:11 UTC; myaseen208 | 
| Repository: | CRAN | 
| Date/Publication: | 2024-03-23 23:40:02 UTC | 
Divisia Monetary Aggregates Index
Description
Calculates Divisia monetary aggregates index as given in Barnett, W. A. (1980).
Usage
## Default S3 method:
dmai(.data, method = c("Barnett", "Hancock"), logbase = NULL)
Arguments
.data | 
 data.frame  | 
method | 
 Method to calculate Divisia monetary aggregates index, Barnett or Hancock  | 
logbase | 
 base of log to be used in Barnett divisia monetary aggregates index method, default is NULL or 10  | 
Value
Divisia Monetary Aggregates Index
Author(s)
Muhammad Yaseen (myaseen208@gmail.com)
Ahmad Nadeem (Ahmed.Nadeem@sbp.org.pk)
References
Barnett, W. A. (1980). Economic Monetary Aggregates: An Application of Aggregation and Index Number Theory. Journal of Econometrics. 14(1):11-48. (https://www.sciencedirect.com/science/article/pii/0304407680900706)
Examples
Data <-
  tibble::tibble(
    Date = paste(c("Jun", "Dec"), rep(seq(from = 2000, to = 2017, by = 1), each = 2), sep = "-")
  , x1    = runif(n = 36, min = 162324, max = 2880189)
  , x2    = runif(n = 36, min = 2116,   max =   14542)
  , x3    = runif(n = 36, min = 92989,  max = 3019556)
  , x4    = runif(n = 36, min = 205155, max = 4088784)
  , x5    = runif(n = 36, min = 6082,   max =  186686)
  , x6    = runif(n = 36, min = 11501,  max =   50677)
  , x7    = runif(n = 36, min = 61888,  max =  901419)
  , x8    = runif(n = 36, min = 13394,  max =  347020)
  , x9    = runif(n = 36, min = 25722,  max =  701887)
  , x10   = runif(n = 36, min = 6414,   max =   37859)
  , x11   = runif(n = 36, min = 11688,  max =  113865)
  , x12   = runif(n = 36, min = 2311,   max =   23130)
  , x13   = runif(n = 36, min = 23955,  max =  161318)
  , r1    = runif(n = 36, min = 0.00,   max =  0.00)
  , r2    = runif(n = 36, min = 0.00,   max = 0.00)
  , r3    = runif(n = 36, min = 0.00,   max = 0.00)
  , r4    = runif(n = 36, min = 0.93,   max = 7.43)
  , r5    = runif(n = 36, min = 1.12,   max = 7.00)
  , r6    = runif(n = 36, min = 0.99,   max = 7.93)
  , r7    = runif(n = 36, min = 1.51,   max = 7.42)
  , r8    = runif(n = 36, min = 2.20,   max = 9.15)
  , r9    = runif(n = 36, min = 2.64,   max = 9.37)
  , r10   = runif(n = 36, min = 2.80,   max = 11.34)
  , r11   = runif(n = 36, min = 3.01,   max = 12.41)
  , r12   = runif(n = 36, min = 2.78,   max = 13.68)
  , r13   = runif(n = 36, min = 3.23,   max = 14.96)
  )
Data$Date <- as.Date(paste("01", Data$Date, sep = "-"), format = "%d-%b-%Y")
Data
# Divisia monetary aggregates index using Barnett method
DMAIBarnett <- dmai(.data = Data, method = "Barnett", logbase = NULL)
DMAIBarnett
DMAIBarnett1 <- dmai(.data = Data, method = "Barnett", logbase = 10)
DMAIBarnett1
DMAIBarnett2 <- dmai(.data = Data, method = "Barnett", logbase = 2)
DMAIBarnett2
DMAIBarnett3 <- dmai(.data = Data, method = "Barnett", logbase = exp(1))
DMAIBarnett3
# Divisia monetary aggregates index using Hancock method
DMAIHancock <- dmai(.data = Data, method = "Hancock")
DMAIHancock
library(ggplot2)
ggplot(data = DMAIBarnett, mapping = aes(x = Date, y = DMAI)) +
  geom_point() +
  geom_line() +
  geom_text(aes(label = round(DMAI, 2)), vjust = "inward", hjust = "inward") +
  scale_x_date(
                date_breaks = "6 months"
              , date_labels = "%b-%Y"
              , limits = c(min(DMAIBarnett$Date), max = max(DMAIBarnett$Date))) +
  theme_bw() +
  theme(axis.text.x  = element_text(angle = 90))
ggplot(data = DMAIHancock, mapping = aes(x = Date, y = DMAI)) +
  geom_point() +
  geom_line() +
  geom_text(aes(label = round(DMAI, 2)), vjust = "inward", hjust = "inward") +
  scale_x_date(
                date_breaks = "6 months"
              , date_labels = "%b-%Y"
              , limits = c(min(DMAIHancock$Date), max = max(DMAIHancock$Date))) +
  theme_bw() +
  theme(axis.text.x  = element_text(angle = 90))
Divisia Monetary Aggregates Index
Description
The dmai package provides functionalities to calculate
Divisia monetary aggregates index as given in  Barnett, W. A. (1980).
Author(s)
Muhammad Yaseen (myaseen208@gmail.com)
Ahmad Nadeem (Ahmed.Nadeem@sbp.org.pk)
References
Barnett, W. A. (1980). Economic Monetary Aggregates: An Application of Aggregation and Index Number Theory. Journal of Econometrics. 14(1):11-48. (https://www.sciencedirect.com/science/article/pii/0304407680900706).