hedonic.function: Constructor for a "hedonic.function" Object

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/hepi.R

Description

This function constructs objects of class "hedonic.function".

Usage

1
2
hedonic.function(hf, characteristics.names, env = NULL, 
                 call = match.call(), description = "")

Arguments

hf

The hedonic function.

characteristics.names

A vector of characteristics names.

env

An optional list of objects needed internally for the evaluation of hf.

call

An object of class "call", describing how hf was created.

description

A textual description of the hedonic function hf.

Details

A hedonic function predicts a price value for an item based on a list of characteristics expressions. hf is thus an object of class "function" having at least the named argument data representing the data frame for which new prices are to be estimated.

characteristics.names should contain the names of all variables that must be available in data in order to provide valid price predictions. It can be used to check whether the returned hedonic function is applicable for a given data set.

Value

An object of class "hedonic.function".

Author(s)

Michael Beer r-hepi@michael.beer.name

See Also

hedonic.function-class

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Build hedonic function from training data set
build.hf.loglin <- function(traindata) {
    model <- lm(log(price) ~ ., traindata)

    hf <- function(data) {
        predict(model, newdata = data)
    }

    hedonic.function(
        hf = hf,
        characteristics.names = all.vars(formula(model)),
        env = list(model = model),
        call = match.call(),
        description = "Semi-logarithmic hedonic function."
    )
}

hepi documentation built on May 2, 2019, 6:17 p.m.