*! version 1.0.0 08aug2022

help rrp

Title

rrp -- Rescaled Regression Prediction (RRP) using two samples

Syntax

rrp
indepvars
[if] [in]
[weight],
impute(newvar)
proxies(varlist)
first(model)
partialrsq()
robust
cluster(clustvar)

Description

rrp implements a Rescaled Regression Prediction (RRP) using two samples in two steps.
First it creates a new variable, by imputing the dependent variable in the current sample,
using the stored first-stage regression, fitted in the sample that contains the dependent variable
and the proxies. The samples can be in different datasets or can be appended, indexed by a sample identifier.
The command requires the proxy variables in the two samples (first-stage regression and in proxies())
to have the same name (order does not matter). The user needs to correctly input the partial R-squared (see example).
The command returns the results of the second-stage regression and creates the new imputed variable.

Options

impute(newvar) is used to select the name of the new imputed variable

proxies(varlist) specifies the variables, common at both datasets, used as proxies for imputing the dependent variable.

first(model) specifies the first-stage regression in the dataset that contains the dependent variable.

partialrsq() contains the partial R-squared. It can be a value or a stored scalar.

robust is used to calculate standard errors that are robust to the presence of arbitrary heteroskedasticity.

cluster(clustvar) is used to calculate standard errors that are robust to both arbitrary heteroskedasticity and allow intra-group correlation.

Example

Design

. drop _all

. matrix C = (2, .5 \ .5, 2)

. mat A = cholesky(C)

. set obs 100

. gen sample = 1

. gen c1= invnorm(uniform())

. gen c2= invnorm(uniform())

. mat a1 = A[1,1...]

. matrix score x = a1

. matrix a2 = A[2,1...]

. matrix score w = a2

. gen y = 1 + 1*x + .5*w + rnormal(0,4)

. gen zA = 1 + 0.5*y - .0*w + rnormal(0,2)

. gen zB = 1 + 0.3*y - .0*w + rnormal(0,2)

. set obs 300

. replace sample = 2 in 101/300

. replace c1= invnorm(uniform()) in 101/300

. replace c2= invnorm(uniform()) in 101/300

. mat a1 = A[1,1...]

. matrix score x = a1 in 101/300, replace

. matrix a2 = A[2,1...]

. matrix score w = a2 in 101/300, replace

. replace y = 1 + 1*x + .5*w + rnormal(0,4) in 101/300

. replace zA = 1 + 0.5*y - .0*w + rnormal(0,2) in 101/300

. replace zB = 1 + 0.3*y - .0*w + rnormal(0,2) in 101/300

. drop c1 c2

. replace x=. if sample==1

. replace y=. if sample==2

First-stage regression and partial R-squared calculation

. reg y w if sample==1

. scalar R2_A = e(r2)

. reg y zA zB w if sample==1

. est store stage1

. scalar R2_B = e(r2)

. scalar Rsq = (R2_B-R2_A)/(1-R2_A)

Imputation and second-stage estimation

. rrp x w if sample==2, impute(yhat) proxies(zA zB) partialrsq(Rsq) first(stage1)

Saved results

Scalars

e(N) number of observations

e(N_clust) number of clusters

e(df_m) model degrees of freedom

e(df_r) residual degrees of freedom

e(F) F statistic

e(r2) R-squared

e(rmse) root mean squared error

e(rank) rank of e(V)

Macros

e(cmd) rrp

e(cmdline) command as typed

e(depvar) name of imputed dependent variable

e(title) title in estimation output

e(clustvar) name of cluster variable

e(vcetype) title used to label Std. Err.

e(vce) vcetype specified

e(properties) b V

Matrices

e(b) coefficient vector

e(V) variance-covariance matrix of the estimators

Functions

e(sample) marks estimation sample

Reference

Crossley, T.F., Levell, P., and Poupakis, S. (2022). Regression with an Imputed Dependent Variable, Journal of Applied Econometrics https://doi.org/10.1002/jae.2921.

Author

Stavros Poupakis

University College London

s.poupakis@ucl.ac.uk