Description Usage Arguments Value Examples
Take smiliar inputs as the GEKS function and return the decomposition on the multilateral scale.
1 | GEKS_decomp(times, price, id, weight, custom_time = c(), window_length = NULL)
|
times |
vector of the times at which price observations were made. |
price |
vector of log of prices at the given time |
id |
vector of distinct identification number of consumer goods |
weight |
vector of expenditure weights used in the regressions |
custom_time |
either empty (will assume latest periods) or a vector of length two relating to times compared where [1] is the 'start_time' time and [2] is the 'to' time e.g Comparing contribution start_time "1973-04-01" to "1973-05-01" would be c("1973-04-01", "1973-05-01") |
window_length |
optional. Single number for length of window for the data that regressions are fit on. Note if window_length is present it assumes custom time is latest two periods in window. |
A dataframe containing the numeric contribution (contrib
) of every price observation
in the window, the product of which will (roughly) equal the index movement between the two time periods. p_contrib
is
the standardised percentage contribution of the observation, the sum of which will equal 1.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | library(TPDdecomp)
contributions <- with(
turvey,
GEKS_decomp(times = month,
price = price,
id = commodity,
weight = price*quantity,
custom_time = as.Date(c("1973-04-30","1973-05-31")),
window_length = NULL)
)
str(contributions)
Classes ‘data.table’ and 'data.frame': 5 obs. of 5 variables:
$ from : Date, format: "1973-04-30" "1973-04-30" "1973-04-30" ...
$ to : Date, format: "1973-05-31" "1973-05-31" "1973-05-31" ...
$ id : Factor w/ 5 levels "Apples","Grapes",..: 1 2 3 4 5
$ contrib : num 1.035 0.998 1.017 1.034 1
$ p_contrib: num 0.411 -0.02 0.206 0.403 0
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.