|
We assume that the random variables
are independent with mean
and covariance matrix diag
.
In the
eiv
quantlib the method of moments is used to estimate the
parameters.
In the literature, it's generally assumed that
are jointly normally
distributed, and that
follows a bivariate normal distribution (Fuller; 1987).
Even without the normality assumption, various moment methods may be used
to estimate all parameters.
Furthermore, we assume that
. Thus,
the mean and the variance of the joint distribution of
are
We write
,
and
.
Using the method of moments, we define the solutions of the following equations
as the estimators of
Let's first investigate the case of single explanatory variable,
i.e., . The least squares estimator based on the observed
variables is biased towards zero because of the disturbance of the
measurement error. In fact, let
![]() |
(3.4) |
![]() |
(3.5) |
In this section, we consider several estimators for the linear eiv models. These estimators have different forms based on the corresponding assumption on the variances. A complete account is given in Fuller (1987).
Assume that the degree of attenuation is known. In this case,
the estimators of
and
are defined as
and
. Moreover, their variances
are estimated by
![]() |
and
![]() |
where
and
Incidentally, the estimators of
and
always have the
same forms, whatever the estimators of
and
.
The quantlet
eivknownatt
evaluates the moment estimates of the
parameters
,
,
and
. Its syntax is the following:
gest = eivknownatt(w,y,kww)
where
This quantlet returns a list gest, which contains the followings estimates:
We consider the following example, based on simulated data, in which
the distribution of the measurement error is normal with mean 0
and standard deviation
, the latent variable
having the same
distribution, so that the reliability ratio equals
library("eiv") n = 100 randomize(n) x=0.9*normal(n) ; latent variables w=x+0.9*normal(n) ; manifest variables y=0.9+0.8*x+0.01*normal(n) kww =0.5 ; reliability ratio gest=eivknownatt(w,y,kww) gest.mux ; the estimate of the mean of x gest.beta1 ; the estimate of b (true value is 0.8) gest.beta0 ; the estimate of a (true value is 0.9) gest.sigmax ; the estimate of the variance of x gest.sigmau ; the estimate of the variance of u gest.sigmae ; the estimate of the variance of e gest.varbeta1 ; the estimate of the variance of ; the estimate of beta1 gest.verbeta0 ; the estimate of the variance of ; the estimate of beta0
The parameter estimates are the following:
gest.mux=-0.093396 gest.beta1=0.79286 gest.beta0=0.8425 gest.sigmax=0.72585 gest.sigmau=0.72585 gest.sigmae=0.074451 gest.varbeta1=0.0085078 gest.varbeta0=0.0054358
The true values are
,
,
,
and
.
Assume that the ratio of two variances of the two measurement errors,
, is known.
Then the estimators of the parameters of the most interest are defined as
![]() |
and
![]() |
where
,
,
,
The quantlet
eivknownratue
estimates the parameters in this
situation. Its syntax is similar to that of the quantlet
eivknownatt
:
gest = eivknownratue(w,y,delta)
where delta is the ratio of the two variances.
For the purpose of illustration, we use the data which Fuller (1987) originally analyzed.
The variables and
are the numbers of hen pheasants in Iowa
at August and spring in the period from 1962 to 1976. Both measurement are
subjected to the measurement errors. The ratio of
to
is supposed to be
. We use the following
XploRe
code:
v=read("pheasants.dat") n=rows(v) y=v[,2] x=v[,3] delta=1/6
The data set is available in XploRe . Running
library("eiv") gest=eivknownratue(x,y,delta)
we obtain the estimates of slope and intercept as (s.e.
)
and
(s.e.
).
In Figure 3.1, the empty circles represents the observation data, the solid line is based on the ordinary least squares estimator, and the dashed line is the fit based on the moment estimator. Even in this small-sample data set, different conclusions are obvious if we are ignoring the measurement errors.
When the variance of measurement error
is known, we define
the estimators of
and the variance of this estimator as
and
![]() |
where
and
The quantlet
eivknownvaru
evaluates the moment estimates stated
above. Its syntax is similar to that of the two previous quantlets:
gest = eivknownvaru(w,y,sigmau)
where sigmau is the variance of the error .
We now use the quantlet
eivknownvaru
to analyze a real example
from Fuller (1987). In this example, we study the relationship between the yield
of corn (
) and
soil nitrogen (
), the latter of which cannot be measured exactly. The variance
arising from these two variables has been estimated to be
.
We assume that
is known and compute the related estimates
using the quantlet
eivknownvaru
. The ordinary least squares estimates are
and
,
ignoring the measurement errors. We use the
XploRe
code:
z=read("corn.dat") n=rows(z) y=z[,1] x=z[,2:3] w=x[,2] sigmau=57 gest=eivknownvaru(w,y,sigmau)
The moment estimates from this example
are
(s.e. 0.1745) and
(s.e. 12.542),
and
. So, the reliability ratio is
.
In Figure 3.2, the circles represent the observation
data, the solid line is based on the ordinary least squares estimator, and the
dashed line is the fit based on the moment estimator.
Theoretical study and empirical evidence have shown that the method of
moments estimator given in (3.6) performs poorly in small samples,
since such ratios are typically biased estimators of the ratio of the
expectations. For this reason,
we consider the modification proposed by Fuller (1987) of this estimator.
Define an estimator of by
![]() |
![]() |
![]() |
![]() |
The quantlet
eivknownvarumod
implements the calculating procedure.
gest = eivknownvarumod(omega, w, y, sigmau)
Input parameters:
We return to consider the data set ``corn'' and we use the following XploRe code.
library("eiv") z=read("corn.dat") z=sort(z,3) n=rows(z) y=z[,1] x=z[,2:3] vv=inv(x'*x)*(x'*y) w=x[,2] sigmau=57 omega=2+2*inv(var(w))*sigmau gest=eivknownvarumod(omega,w,y,sigmau)
omega |
![]() |
![]() |
![]() |
0 | 0.34404 | 0.42316 | 0.030445 |
1 | 0.34404 | 0.41365 | 0.030165 |
2 | 0.34404 | 0.40455 | 0.029927 |
![]() |
0.34404 | 0.40125 | 0.029847 |
5 | 0.34404 | 0.37952 | 0.029419 |
10 | 0.34404 | 0.34404 | 0.029072 |
The estimates
and
decrease with omega, and
is equivalent to
when omega
. The linear fitting for omega
is shown in Figure 3.3.
In this paragraph, we assume that we can observe a third variable which
is correlated with
. The variable
is called as an instrumental
variable for
if
![]() |
|||
![]() |
Although we do not assume that and
are known
or that
is zero, we can still estimate
and
by
the method of moments as follows: Let
and
,
where
and
.
Furthermore, we estimate the variances of the approximate distributions of
and
by
![]() |
The quantlet
eivlinearinstr
accomplishes the implementation.
Its syntax is the following:
gest = eivlinearinstr(w,z,y)
The estimates of and
are returned in the list gest
Before ending this section, we use the quantlet
eivlinearinstr
to study a
practical data-set, in which we study Alaskan earthquakes for the period
from 1969-1978. The data are from Fuller (1987). In the data structure,
we have the logarithm of the seismogram amplitude of 20 second surface waves, denoted by
y, the logarithm of the seismogram amplitude of longitudinal body waves,
denoted by w and the logarithm of maximum seismogram trace amplitude at
short distance, denoted by z.
library("eiv") v=read("alaskan.dat") y=v[,2] w=v[,3] z=v[,4] gest=eivlinearinstr(w,z,y)
gest.beta0=-4.2829 (s.e.1.1137) gest.beta1=1.796 (s.e.0.2131)
Figure 3.4 shows the fitted results, in which the circles represent the data y, the solid line is based on the above estimates, and the dashed line contains the estimated values based on the regression of y on w. This means that if we ignore the measurement errors, then it shows an obvious difference.
Suppose that is a
-dimensional row vector with
,
is a
-dimensional column vector, and the
-dimensional
vectors
are independently normal
random vectors.
Assume that the covariance between
and
,
and the covariance matrix of
,
are
known. Then the other parameters, such as
,
and others,
are estimated by
![]() |
![]() |
![]() |
|
![]() |
![]() |
![]() |
|
![]() |
![]() |
![]() |
The quantlet
eivvec1
evaluates these estimates.
Its syntax is the following:
gest = eivvec1(w, y, sigue, siguu)
The estimates are listed in the variable gest as follows:
library("xplore") library("eiv") n = 100 randomize(n) nu =#(2,3,4) sig=0*matrix(3,3) sig[,1]=#(0.25, 0.9, 0.1) sig[,2]=#(0.9, 1, 0.2) sig[,3]=#(0.1, 0.2, 4) x=normal(n,3)*sig+nu' w=x+0.01*normal(n,3) a1=#(1.2, 1.3, 1.4) y=0.75+x*a1+0.09*normal(n) sigue=#(0.11, 0.09, 045) siguu=0*matrix(3,3) siguu[,1]=#(1.25, 0.009, 0.01) siguu[,2]=#(0.009,0.081, 0.02) siguu[,3]=#(0.01, 0.02, 1.96) gest=eivvec1(w,y,sigue,siguu)
The estimates are:
,
,
,
,
.
In this paragraph, our aim is to estimate the parameters
in -dimensional measurement error models when the entire error
covariance structure is either known, or known up to a multiple scalar.
Assume that the errors
obey normal distribution with
mean zero vector and covariance
, which can be represented
as
, where
is known.
Then the maximum likelihood estimators of
and
are
![]() |
![]() |
![]() |
|
![]() |
![]() |
![]() |
![]() |
gest = eivvec2(w, y, gamma)
where gamma is a known matrix.
The following simulated example shows us how to run the quantlet
eivvec2
.
library("xplore") library("eiv") n=100 randomize(n) sig=0*matrix(3,3) sig[,1]=#(0.25, 0.09, 0.1) sig[,2]=#(0.09, 1, 0.2) sig[,3]=#(0.1, 0.2, 0.4) x=sort(uniform(n,3)*sig) w=x+0.03*normal(n,3) beta0=#(0.5, 0.6, 0.7) y=x*beta0+0.05*normal(n) gamma=(#(0.03,0,0,0))'|(#(0,0,0)~0.05*unit(3)) gest=eivvec2(w,y,gamma)
The estimates are the following:
gest.hatbeta=(0.18541, 0.0051575,-0.088003) gest.sigmam=0.015424
Consider the method of instrumental variables for the -dimensional
case. Assume that the
dimensional vector of instrumental
variables
is available and that
. In addition, assume
that
is nonsingular with probability one,
and the rank of
is
with probability one. When
, we define the estimator of
as
![]() |
![]() |
![]() |
![]() |
The quantlet
eivlinearinstrvec
achieves the calculation
procedure in
XploRe
. This generalizes the quantlet
eivlinearinstr
to the
-dimensional case.
gest =eivlinearinstrvec(w,z,y)
We end this section with an example, in which we randomly produce
variables , instrumental variables
, and response
.
Then we execute the quantlet
eivlinearinstrvec
and get
the estimates.
library("xplore") library("eiv") n=100 randomize(n) w=floor(6*uniform(n,3)+#(4,5,5)') z=floor(8*uniform(n,4)+#(3,3,2,2)') y=floor(9*uniform(n)+2) gest=eivlinearinstrvec(w,z,y)
The estimate of the parameter vector is
gest=(0.19413, 0.24876, 0.37562)