calculate_price_index {cbsREPS} | R Documentation |
Calculate index based on specified method (Fisher, Laspeyres, Paasche, HMTS)
Description
Central hub function to calculate index figures using different methods.
Usage
calculate_price_index(
method,
dataset,
period_variable,
dependent_variable,
continuous_variables,
categorical_variables,
reference_period = NULL,
number_of_observations = TRUE,
periods_in_year = 4,
production_since = NULL,
number_preliminary_periods = 3,
resting_points = FALSE,
index = TRUE,
imputation = FALSE
)
Arguments
method |
one of: "fisher", "laspeyres", "paasche", "hmts" |
dataset |
data frame with input data |
period_variable |
name of the variable indicating time periods |
dependent_variable |
usually the price |
continuous_variables |
vector with numeric quality-determining variables |
categorical_variables |
vector with categorical variables (also dummies) |
reference_period |
period or group of periods that will be set to 100 |
number_of_observations |
show number of observations? Default = TRUE |
periods_in_year |
(HMTS only) number of periods per year (e.g. 12 for months) |
production_since |
(HMTS only) start period for production simulation |
number_preliminary_periods |
(HMTS only) number of preliminary periods |
resting_points |
(HMTS only) return detailed outputs? Default = FALSE |
index |
(Laspeyres/Paasche only) include index column? Default = TRUE |
imputation |
(Laspeyres/Paasche only) include imputation values? Default = FALSE |
Value
A data.frame (or list for when method is HMTS with resting_points = TRUE)
Author(s)
Vivek Gajadhar
Examples
# Laspeyres index
Tbl_Laspeyres <- calculate_price_index(
method = "laspeyres",
dataset = data_constraxion,
period_variable = "period",
dependent_variable = "price",
continuous_variables = "floor_area",
categorical_variables = "neighbourhood_code",
reference_period = 2015,
number_of_observations = TRUE,
imputation = FALSE
)
head(Tbl_Laspeyres)
# Paasche index
Tbl_Paasche <- calculate_price_index(
method = "paasche",
dataset = data_constraxion,
period_variable = "period",
dependent_variable = "price",
continuous_variables = "floor_area",
categorical_variables = "neighbourhood_code",
reference_period = 2015,
number_of_observations = TRUE,
imputation = FALSE
)
head(Tbl_Paasche)
# Fisher index (geometric mean of Laspeyres and Paasche)
Tbl_Fisher <- calculate_price_index(
method = "fisher",
dataset = data_constraxion,
period_variable = "period",
dependent_variable = "price",
continuous_variables = "floor_area",
categorical_variables = "neighbourhood_code",
reference_period = 2015,
number_of_observations = TRUE
)
head(Tbl_Fisher)