Learn R Programming

McSpatial (version 2.0)

repsale: Repeat Sales Estimation

Description

Standard and Weighted Least Squares Repeat Sales Estimation

Usage

repsale(price0,time0,price1,time1,mergefirst=1, graph=TRUE,graph.conf=TRUE,conf=.95, stage3=FALSE,stage3_xlist=~timesale,print=TRUE)

Arguments

price0
Earlier price in repeat sales pair
time0
Earlier time in repeat sales pair
price1
Later price in repeat sales pair
time1
Later time in repeat sales pair
mergefirst
Number of initial periods with coefficients constrained to zero. Default: mergefirst=1
graph
If TRUE, graph results. Default: graph=T
graph.conf
If TRUE, add confidence intervals to graph. Default: graph.conf=T
conf
Confidence level for intervals. Default: .95
stage3
If stage3 = NULL, no corrections for heteroskedasticty. If stage3="abs", uses the absolute value of the first-stage residuals as the dependent variable in the second-stage regression. If stage3="square", uses the square of the first-stage residuals as the dependent variable. Default: stage3=NULL.
stage3_xlist
List of explanatory variables for heteroskedasticity. By default, the single variable timesale = time1-time0 is constructed and used as the explanatory variable when stage3="abs" or stage3="square". Alternatively, a formula can be provided for a user-specified list of explanatory variables, e.g., stage3_xlist=~x1+x2. Important: note the "~" before the variable list.
print
If print=T, prints the regression results. Prints one stage only -- the first stage when stage=NULL and the final stage when stage3="square" or stage3="abs". Default: print=T.

Value

fit
Full regression model.
pindex
The estimated price index.
lo
The lower bounds for the price index confidence intervals.
hi
The upper bounds for the price index confidence intervals.
dy
The dependent variable for the repeat sales regression, dy = price1-price0.
xmat
The matrix of explanatory variables for the repeat sales regressions. dim(xmat) = nt - mergefirst, where nt = the number of time periods and mergefirst is specified in the call to repsale.

Details

The repeat sales model is $$ y_t - y_s = \delta_t - \delta_s + u_t - u_s$$

where y is the log of sales price, s denotes the earlier sale in a repeat sales pair, and t denotes the later sale. Each entry of the data set should represent a repeat sales pair, with $price0 = y(s)$, $price1 = y(t)$, $time0 = s$, and $time1 = t$. The function repsaledata can help transfer a standard hedonic data set to a set of repeat sales pairs.

Repeat sales estimates are sometimes very sensitive to sales from the first few time periods, particularly when the sample size is small. The option mergefirst indicates the number of time periods for which the price index is constrained to equal zero. The default is mergefirst = 1, meaning that the price index equals zero for just the first time period. The repsale command does not have an option for including an intercept in the model.

Following Case and Shiller (1987), many authors use a three-stage procedure to construct repeat sales price indexes that are adjusted for heteroskedasticity related to the length of time between sales. Common specifications for the second-stage function are $e^2 = \alpha0 + \alpha1 (t-s)$ or $|e| = \alpha0 + \alpha1 (t-s)$, where e represents the first-stage residuals. The first equation implies an error variance of $\sigma^2 = e^2$ and the second equation leads to $\sigma^2 = |e|^2.$ The repsale function uses a standard F test to determine whether the slope cofficients are significant in the second-stage regression. The results are reported if print=T.

The third-stage equation is

$$ \frac{y_t - y_s}{\hat{\sigma}} = \frac{\delta_t - \delta_s}{\hat{\sigma}} + \frac{u_t - u_s}{\hat{\sigma}}$$

This equation is estimated by regressing $y(t) - y(s)$ on the series of indicator variables implied by $\delta(t) - \delta(s)$ using the weights option in lm with weights = $1/sigma^2$

References

Case, Karl and Robert Shiller, "Prices of Single-Family Homes since 1970: New Indexes for Four Cities," New England Economic Review (1987), 45-56.

See Also

repsaledata

repsalefourier

repsaleqreg

Examples

Run this code
set.seed(189)
n = 2000
# sale dates range from 0-10
# drawn uniformly from all possible time0, time1 combinations with time0<time1
tmat <- expand.grid(seq(0,10), seq(0,10))
tmat <- tmat[tmat[,1]<tmat[,2], ]
tobs <- sample(seq(1:nrow(tmat)),n,replace=TRUE)
time0 <- tmat[tobs,1]
time1 <- tmat[tobs,2]
timesale <- time1-time0
table(timesale)

# constant variance; index ranges from 0 at time 0 to 1 at time 10
y0 <- time0/10 + rnorm(n,0,.2)
y1 <- time1/10 + rnorm(n,0,.2)
fit <- repsale(price0=y0, price1=y1, time0=time0, time1=time1)

# variance rises with timesale
# var(u0) = .2^2; var(u1) = (.2 + timesale/10)^2
# var(u1-u0) = var(u0) + var(u1) = 2*(.2^2) + .4*timesale/10 + (timesale^2)/100
y0 <- time0/10 + rnorm(n,0,.2)
y1 <- time1/10 + rnorm(n,0,.2+timesale/10)
par(ask=TRUE)
fit <- repsale(price0=y0, price1=y1, time0=time0, time1=time1)
summary(fit$pindex)
fit <- repsale(price0=y0, price1=y1, time0=time0, time1=time1, stage3="abs")
summary(fit$pindex)
timesale2 <- timesale^2
fit <- repsale(price0=y0, price1=y1, time0=time0, time1=time1, stage3="square", 
  stage3_xlist=~timesale+timesale2)

Run the code above in your browser using DataLab