Description Usage Arguments Details Value Author(s) See Also Examples
This function constructs objects of class "hedonic.function"
.
1 2 | hedonic.function(hf, characteristics.names, env = NULL,
call = match.call(), description = "")
|
hf |
The hedonic function. |
characteristics.names |
A vector of characteristics names. |
env |
An optional list of objects needed internally for the evaluation of |
call |
An object of class |
description |
A textual description of the hedonic function |
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.
An object of class "hedonic.function"
.
Michael Beer r-hepi@michael.beer.name
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."
)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.