rs_x: Shiller's X matrix

Description Usage Arguments Details References See Also Examples

View source: R/rsi.R

Description

Compute the 'X' matrix in Shiller (1991, section II) from sales-pair data to calculate a repeat-sales price index.

Usage

1
rs_x(x, y, z)

Arguments

x, y

A numeric vector giving the price of the second and first sale, respectively.

z

Shiller's 'Z' matrix. See rs_z.

Details

This function is a simple wrapper to calculate (z > 0) * x - (z < 0) * y.

References

Shiller, R. J. (1991). Arithmetic repeat sales price estimators. Journal of Housing Economics, 1(1):110-126.

See Also

See rs_z for making Shiller's Z matrix.

Examples

1
2
3
4
5
6
7
8
9
# Make some data
x <- data.frame(date = c(3, 2, 3), date_prev = c(1, 1, 2), price = 3:1, price_prev = 1)

# Calculate ARS index
Z <- rs_z(x$date, x$date_prev)
X <- rs_x(x$price, x$price_prev, Z)
Y <- -X[, 1]
b <- solve(crossprod(Z[, -1], X[, -1]), crossprod(Z[, -1], Y))[, 1]
100 / b

marberts/ppd documentation built on March 27, 2020, 7:21 p.m.