Library: | eiv |
See also: | eivknownvaru |
Quantlet: | eivknownvarumod | |
Description: | eivknownvarumod presents modified moment estimates of parameters for the measurement error models, which has only one variable x. The variance of measurement error sigma_u is known. All of the variables obey normal distributions. |
Usage: | {mux,beta1,beta0,sigmax, sigmae,varbeta1,varbeta0} =eivknownvarumod(alpha,w,y,sigmau) | |
Input: | ||
alpha | scalar | |
w | n x 1 matrix, the design variables | |
y | n x 1 matrix, the response | |
sigmau | scalar, the variance of measurement error sigma_u | |
Output: | ||
mux | scalar, the mean value of x | |
beta1 | scalar, the estimate | |
beta0 | scalar, the estimate | |
sigmax | scalar, the estimate of the variance of x | |
sigmae | scalar, the estimate of the variance of error e | |
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) x=9*normal(n) w=x+9*normal(n) y=0.9+0.8*x+0.01*normal(n) alpha=5 sigmau=81 gest=eivknownvarumod(alpha,w,y,sigmau) gest.mux gest.beta1 gest.beta0 gest.sigmax gest.sigmae gest.varbeta1 ; the estimate of the variance of the estimate of beta1 gest.varbeta0 ; the estimate of the variance of the estimate of beta0
Contents of mux [1,] -0.93396 Contents of beta1 [1,] 0.84348 Contents of beta0 [1,] 0.3736 Contents of sigmax [1,] 64.17 Contents of sigmae [1,] 7.3409 Contents of varbeta1 [1,] 0.032728 Contents of varbeta0 [1,] 0.62606