hpiModel {hpiR} | R Documentation |
Wrapper to estimate model approaches (generic method)
Description
Generic method to estimate modeling approaches for indexes
Usage
hpiModel(model_type, hpi_df, estimator = "base", log_dep = TRUE,
trim_model = TRUE, mod_spec = NULL, ...)
Arguments
model_type |
Type of model to estimate ('rt', 'hed', 'rf') |
hpi_df |
Dataset created by one of the *CreateTrans() function in this package. |
estimator |
Type of estimator to be used ('base', 'weighted', 'robust') |
log_dep |
default TRUE, should the dependent variable (change in price) be logged? |
trim_model |
default TRUE, should excess be trimmed from model results ('lm' or 'rlm' object)? |
mod_spec |
Model specification |
... |
Additional Arguments |
Value
hpimodel object consisting of:
- estimator
Type of estimator
- coefficients
Data.frame of coefficient
- model_obj
class 'rtmodel' or 'hedmodel'
- mod_spec
Full model specification
- log_dep
Binary: is the dependent variable in logged format
- base_price
Mean price in the base period
- periods
'data.frame' of periods
- approach
Type of model used
Examples
# Load data
data(ex_sales)
# With a raw transaction data.frame
rt_data <- rtCreateTrans(trans_df = ex_sales,
prop_id = 'pinx',
trans_id = 'sale_id',
price = 'sale_price',
periodicity = 'monthly',
date = 'sale_date')
# Create model object
hpi_model <- hpiModel(model_type = 'rt',
hpi_df = rt_data,
estimator = 'base',
log_dep = TRUE)
# For custom weighted repeat transaction model
hpi_model_wgt <- hpiModel(model_type = 'rt',
hpi_df = rt_data,
estimator = 'weighted',
weights = runif(nrow(rt_data), 0, 1))
[Package hpiR version 0.3.2 Index]