Description Usage Arguments Details Value Examples
Takes a time series of prices and id's and returns an index using the GEKS method.
1 2 3 4 5 6 7 8 9 10 11 |
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 |
features |
required if calculating 'impute-tornqvist'. Data.frame of features. |
window_length |
single number for length of windows of the data that regressions are fit on |
weight |
vector of expenditure weights used in the regressions |
splice_pos |
The position on which to splice the windows together. This can be a number from 1 to window_length or any of c("window", "half","movement", "mean"). |
index_method |
A character string to select the index number method. Valid index number methods are fisher, tornqvist, impute-tronqvist. The default is tornqvist. (see ?IndexNumR::GEKSIndex) |
num_cores |
Number of cores to use for parallel computation. Convention is parallel::detectCores()-1 on local machines |
The function takes vectors for each of the inputs. It is important to note
that the times
argument must be of numeric or Date class. This is because
the order of the dates matters.
The function also has the capability to run in parallel, using the
num_cores
argument. Note that for smaller datasets using non-parallel
code is often faster than using parallelisation due to the overhead
associated with dividing the job across multiple processors.
The function returns a list of 3 items:
a dataframe of the GEKS index
a dataframe of the unspliced coefficients
of the fixed effects model. The number of rows in the data frame is
window_length
* the number of windows in the data
a dataframe of diagnostic results produced during model calculation. The diagnostics dataframe has the following columns:
the % of ids which exist in the window and contribute to the index i.e. the id has at least 2 prices in the window
the number of ids which exist in the window that contribute
number of ids in the entire dataset
number of ids which have any prices in the window
The number of rows of data in this window
25% of the id's have less than this many prices in the window
the geometric mean number of prices per id in this window
the mean number of prices per rid in this window
the median number of prices per rid in this window
75% of the id's have less than this many prices in the window
identifier for the window
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | GEKS(times = turvey$month,
price = turvey$price,
id = turvey$commodity,
window_length = 5,
weight = turvey$price * turvey$quantity,
splice_pos = "mean",
num_cores = NULL)
GEKS(times = turvey$month,
price = turvey$price,
id = turvey$commodity,
window_length = 5,
weight = turvey$price * turvey$quantity,
splice_pos = "mean",
num_cores = 2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.