Tornqvist Price Index Base Year Function
tornb(dat, Year = "Year", pvar = "p", vvar = "v", prodID = "prod", baseyr)
dat | The dataset you would like to use. |
---|---|
Year | Name of the column holding year data. |
pvar | Name of the column holding price data. |
vvar | Name of the column holding value data. |
prodID | Name of the column holding prodID data. |
baseyr | The year dollar values need to be in. |
tornb(dat = data.frame("Year" = c(2001:2020, 2001:2020, 2001:2020, 2001:2020),
"p" = rnorm(n = 80, mean = 1, sd = .1),
"v" = rnorm(n = 80, mean = 500, sd = 300),
"prod" = c(rep_len("A", 20), rep_len("B", 20),
rep_len("C", 20), rep_len("D", 20))),
Year = "Year",
pvar = "p",
vvar = "v",
prodID = "prod",
baseyr = 2015)
#> Year BPI
#> 1 2001 1.1226994
#> 2 2002 1.0715985
#> 3 2003 1.0482602
#> 4 2004 1.1222190
#> 5 2005 1.0359325
#> 6 2006 1.0574533
#> 7 2007 0.8174376
#> 8 2008 1.4375345
#> 9 2009 1.0207680
#> 10 2010 1.1068715
#> 11 2011 1.0838639
#> 12 2012 0.9643593
#> 13 2013 1.1163915
#> 14 2014 1.0276103
#> 15 2015 1.0000000
#> 16 2016 1.0943652
#> 17 2017 1.0685664
#> 18 2018 1.0925590
#> 19 2019 1.0428643
#> 20 2020 0.0000000