Library: | eiv |
See also: | eivlinearinstrvec |
Quantlet: | eivlinearinstr | |
Description: | eivlinearinstr presents the moment estimates of the regression coefficients in the measurement error model with single predictor, which has an instrumental variable W. All of the variables obey normal distributions. All parameters are estimated by moment method in measurement error models. |
Usage: | {beta1,beta0,varbeta1,varbeta0} = eivlinearinstr(x,w,y) | |
Input: | ||
x | n x 1 matrix, the design variables | |
w | n x 1 matrix, the instrumental variables | |
y | n x 1 matrix, the response | |
Output: | ||
beta1 | scalar, the estimate | |
beta0 | scalar, the estimate | |
varbeta1 | scalar, the estimate of the variance of the estimate of beta1 | |
varbeta0 | scalar, the estimate of the variance of the estimate of beta0 |
library("eiv") n=100 randomize(n) V=uniform(n,3).*#(4,3,4)'+#(3,3,3)' y=V[,1] x=V[,2] w=V[,3] gest=eivlinearinstr(x,w,y) gest.beta1 gest.beta0 gest.varbeta1 gest.varbeta0
Contents of beta1 [1,] -1.1709 Contents of beta0 [1,] 10.135 Contents of varbeta1 [1,] 7.3944 Contents of varbeta0 [1,] 152.02