hpiR (version 0.2.0)

hedModel: Estimate hedonic model for index creation

Description

Estimate coefficients for an index via the hedonic approach (generic method)

Usage

hedModel(estimator, hed_df, hed_spec, ...)

Arguments

estimator

Type of model to estimates (base, robust, weighted)

hed_df

Repeat sales dataset from hedCreateSales()

hed_spec

Model specification (`formula` object)

...

Additional arguments

Value

`hedmodel` object: model object of the estimator (ex.: `lm`)

Further Details

`estimator` argument must be in a class of 'base', 'weighted' or 'robust' This function is not generally called directly, but rather from `hpiModel()`

Examples

Run this code
# NOT RUN {
 # Load example data
 data(ex_sales)

 # Create hedonic data
 hed_data <- hedCreateTrans(trans_df = ex_sales,
                           prop_id = 'pinx',
                           trans_id = 'sale_id',
                           price = 'sale_price',
                           date = 'sale_date',
                           periodicity = 'monthly')

 # Estimate Model
 hed_model <- hedModel(estimator = structure('base', class = 'base'),
                       hed_df = hed_data,
                       hed_spec = as.formula(log(price) ~ baths + tot_sf))

# }

Run the code above in your browser using DataLab