Description Usage Arguments Details Value Author(s) References See Also Examples
This function estimates hedonic functions based on a linear regression model for a given dataset.
1 2 3 4 |
learndata |
A |
full.formula |
The formula of the full linear model. See Details. |
min.formula |
If variable selection is wanted, the formula of the minimal linear model. See Details. |
backtrans |
A backtransformation function applied to all predictions. See Details. |
rm.infl |
A logical value indicating whether influential observations should be removed. |
description |
A character string describing the hedonic function. |
return.row.labels |
A logical value indicating whether the row labels of the cleaned training data should be returned. |
allow.variable.selection |
A logical value indicating whether variable selection should be carried out. |
This function estimates a hedonic function based on a linear regression model.
An appropriate model formula must be given in full.formula
. (See lm
for more details about specifying formulae.)
The function given in backtrans
is used to backtransform any predicted
value using the linear model and defauls to the identity function I
.
If, for example, log(price)
stands on the left-hand side of the model
formula, any predicted value needs to be transformed with the exponential function
to a valid price. This can be accomplished by indicating backtrans = exp
.
If rm.infl
is TRUE
, influential observations having
|DFFITS_i| > 2 * sqrt(K/N)
with K being the number of exogenous variables and N the dimension
of the learning data set are removed before fitting the final model. There, the
DFFITS_i values are calculated based on the residuals
of a first fit of a linear model using the model formula full.formula
.
If allow.variable.selection
is TRUE
, a stepwise model selection
based on exact AIC is carried out (see stepAIC
for more details). In this case,
full.formula
acts as upper and min.formula
as lower limit of the search
algorithm. If allow.variable.selection
is FALSE
the hedonic function
is estimated using exactly the formula given in full.formula
.
In description
, a character string describing the hedonic function may be given
which is saved within the returned "hedonic.function"
object.
If return.row.labels == FALSE
, the function returns a "hedonic.function"
object representing the fitted regression model.
If return.row.labels == TRUE
, the function returns a list with following elements:
hf |
The resulting |
row.labels |
A vector containing the row labels of the cleaned training data set. |
Michael Beer r-hepi@michael.beer.name
Beer, M. (2007) Hedonic Elementary Price Indices: Axiomatic Foundation and Estimation Techniques. PhD thesis, University of Fribourg Switzerland, http://www.michael.beer.name/phdthesis.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | data(boston, package = "spdep")
hf0 <- build.hf.lm(
learndata = boston.c,
full.formula = log(MEDV) ~ CRIM + ZN + INDUS + CHAS +
I(NOX^2) + I(RM^2) + AGE + log(DIS) + log(RAD) + TAX +
PTRATIO + B + log(LSTAT),
backtrans = exp,
rm.infl = FALSE,
description = NULL,
return.row.labels = FALSE,
allow.variable.selection = FALSE)
is.applicable.hf(hf0, boston.c)
summary(hf0(boston.c))
plot(boston.c$MEDV, hf0(boston.c), xlab = "Observed", ylab = "Predicted")
abline(0,1)
hf1 <- build.hf.lm(
learndata = boston.c,
full.formula = log(MEDV) ~ CRIM + ZN + INDUS + CHAS +
I(NOX^2) + I(RM^2) + AGE + log(DIS) + log(RAD) + TAX +
PTRATIO + B + log(LSTAT),
min.formula = log(MEDV) ~ 1,
backtrans = exp,
rm.infl = FALSE,
description = NULL,
return.row.labels = FALSE,
allow.variable.selection = TRUE)
summary(hf1(boston.c))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.