* Create data
clear all
matrix input corr = (1,.7,0,0\.7 ,1,0,0\0,0,1,0\0,0,0,1)
matrix input sd = (4,8,3,6)
matrix input mean = (10,7,0,0)
corr2data Yt Xt ey ex, corr(corr) sd(sd) mean(mean) n(500)
* Create flawed measures with random measurement error
gen Y = Yt + ey
gen X = Xt + ex
* A & B. Effects of unreliability on mean, variance
sum Yt Y Xt X
* C. Effect of unreliability on covariance
corr Yt Xt X, cov
* D. Effect of unreliability on bivariate correlation
corr Yt Xt X
* E. Effect of unreliability on bivariate slope coefficient
* Yt is perfectly measured, X has random measurement error
reg Yt Xt
reg Yt X
* F. Effect of unreliability on bivariate slope coefficient
* Now Y is measured with random error, while Xt is measured perfectly
reg Yt Xt
reg Y Xt