Description Usage Arguments Details Value References See Also Examples
Calculates and graphs sample means and quantiles over time. Intended for but not limited to a data set constructed with matchprop or matchmahal
1 2 3 |
form |
A formula of the type y~x, where x represents time. |
taumat |
Vector of quantiles. Default: taumat=c(.10, .25, .50, .75, .90). |
qreglwr.smooth |
If qreglwr.smooth=T, uses qreglwr to smooth the quantile series. If qreglwr.smooth=F, calculates period by period quantiles. |
window |
Window size to be passed to qreglwr if qreglwr.smooth=T. Default: 0.50. |
bandwidth |
Bandwidth to be passed to qreglwr if qreglwr.smooth=T. Default: 0, i.e., not used. |
kern |
Kernel weighting function to be passed to qreglwr if qreglwr.smooth=T. Default is the tri-cube. Options include "rect", "tria", "epan", "bisq", "tcub", "trwt", and "gauss". |
alldata |
Indicates how the alldata option should be treated for qreglwr if qreglwr.smooth=T. Default: alldata=F |
graph.yhat |
If graph.yhat=T, graphs the series of quantile lines. Default: graph.yhat=T. |
graph.mean |
If graph.mean=T, graphs the means over time. Default: graph.yhat=T. |
data |
A data frame containing the data. Default: use data in the current working directory. |
Calculates means and quantiles of y for each time period present in the variable on the right hand side of the model formula. The quantiles can be varied with the taumat option. If qreglwr.smooth=T, matchqreg uses the qreglwr command to smooth the quantile lines and stores the results in the matrix yhat. The unsmoothed, actual quantile values are stored in yhat if qreglwr.smooth=F. The window, bandwidth, kern, and alldata options are passed on to qreglwr if qreglwr.smooth=T.
Although matchqreg is meant to follow the matchprop or matchmahal command, it can be applied to any data set.
yhat |
Matrix of quantiles for y; actual quantiles if qreglwr.smooth=F and smoothed values if qreglowr.smooth=T. Rows represent time periods and columns represent quantiles. |
ymean |
Average value of y for each time period. |
timevect |
Vector of target quantile values. |
Deng, Yongheng, Sing Tien Foo, and Daniel P. McMillen, "Private Residential Price Indices in Singapore," Regional Science and Urban Economics, 42 (2012), 485-494.
Ho, D., Imai, K., King, G, Stuart, E., "Matching as Nonparametric Preprocessing for Reducing Model Dependence in Parametric Causal Inference," Political Analysis 15 (2007), 199-236.
Ho, D., Imai, K., King, G, Stuart, E., "MatchIt: Nonparametric preprocessing for parametric causal inference," Journal of Statistical Software 42 (2011), 1-28..
McMillen, Daniel P., "Repeat Sales as a Matching Estimator," Real Estate Economics 40 (2012), 743-771.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | set.seed(189)
n = 500
# sale dates range from 0-10
# mean and variance of x increase over time, from 1 to 2
# price index for y increases from 0 to 1
timesale <- array(0,dim=n)
x <- rnorm(n,0,1)
for (j in seq(1,10)) {
timesale <- c(timesale, array(j, dim=n))
x <- c(x, rnorm(n,j/10,1+j/10))
}
n = length(x)
y <- x*1 + timesale/10 + rnorm(n, 0, sd(x)/2)
fit <- lm(y~x+factor(timesale))
summary(fit)
heddata <- data.frame(y,x,timesale)
summary(heddata)
par(ask=TRUE)
matchdata <- matchprop(timesale~x,data=heddata,ytreat=0,
distance="logit",discard="both")
table(matchdata$timesale)
fit <- matchqreg(y~timesale,qreglwr.smooth=FALSE,
graph.yhat=TRUE,graph.mean=TRUE,data=matchdata)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.