Learn R Programming

McSpatial (version 1.1.1)

repsaledata: Preparation of a Repeat Sales Data Set

Description

Identifies repeat sales from a data set with observations on sale price, time of sale, and a property id. Returns a data frame in which each observation is a repeat sales pair.

Usage

repsaledata(price,timevar,id)

Arguments

price
Variable representing sale price
timevar
Variable representing date of sale
id
Property id

Value

  • idProperty id
  • price0Sale price at earlier date
  • time0Earlier sales date
  • price1Sale price at later date
  • time1Later sales date

Details

The input to repsaledata is meant to be a set of variables from a standard hedonic data set -- the sale price, date, and an id number for the individual property. The function identifies the subset of properties that sold at least twice and forms a new data set in which each observation is a repeat sales pair, with "0" denoting the earlier time and "1" denoting the later date in the variable names. The observations are ordered first by id, then by timevar, and then by price. A repeat sales pair is formed by matching an observation for which id(t)=id(t-1) and timevar(t)=timevar(t-1). Thus, a property that sold in times 1, 2, and 3 will produce 2 repeat sales pairs: (1) t = 1 and 2, and (2) t = 2 and 3. The output of repsaledata is a data frame with 5 variables. If some of the original hedonic data set variables need to be included in the repeat sales data set, the original hedonic data set and the repsaledata data frame can be merged by the id variable.

See Also

repsale repsalefourier repsaleqreg

Examples

Run this code
id <-      c(1,1,1, 2,2,2, 3,3,3, 4,4,4, 5,5,5)
timevar <- c(1,2,3, 1,2,2, 3,1,1, 1,1,2, 2,2,3)
price <- seq(1:15)
basedata <- data.frame(id,timevar,price)
basedata

rdata <- repsaledata(price,timevar,id)
rdata

Run the code above in your browser using DataLab