Tornqvist Price Index Base Year chain Function

tornc(dat, Year = "Year", pvar = "p", vvar = "v", prodID = "prod", baseyr)

Arguments

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.

Examples

tornc(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       CPI       BPI
#> 1  2001 1.0000000 0.9367590
#> 2  2002 0.9715229 0.9100828
#> 3  2003 1.1646657 1.0910111
#> 4  2004 1.0907801 1.0217980
#> 5  2005 1.2532465 1.1739899
#> 6  2006 1.1631582 1.0895989
#> 7  2007 1.1405850 1.0684532
#> 8  2008 1.1947447 1.1191878
#> 9  2009 1.1451851 1.0727624
#> 10 2010 1.2519664 1.1727907
#> 11 2011 1.1120409 1.0417143
#> 12 2012 1.2805206 1.1995392
#> 13 2013 1.2271966 1.1495874
#> 14 2014 1.2995818 1.2173949
#> 15 2015 1.0675104 1.0000000
#> 16 2016 1.3963820 1.3080734
#> 17 2017 1.2517223 1.1725621
#> 18 2018 1.2995610 1.2173755
#> 19 2019 1.3000293 1.2178142
#> 20 2020 1.3997144 1.3111951