# Re: st: rcal, measurement error model question

 From "Austin Nichols" To statalist@hsphsun2.harvard.edu Subject Re: st: rcal, measurement error model question Date Fri, 12 Dec 2008 10:18:34 -0500

```Richard Valliant <rvalliant@survey.umd.edu>:
I'm pretty sure -rcal- does not do what you want, which I think is
regressing e1 on e2 while specifying the measurement error variance
for each observation on both e2 and e1.  It seems from the paper I
reference that -rcal- will only use the first element of your diagonal
matrix as the assumed error variance for e2, which you can see
directly by doing something like:

clear
drawnorm e1 v1 e2 v2, n(30)
replace v1=exp(v1/10)
replace v2=exp(v2/10)
mkmat v2
mat D = diag(v2)
mat d=D[1,1]
rcal (e1=) (w: e2), suuinit(d)
rcal (e1=) (w: e2), suuinit(D)

Maybe something like this works for your example (but I hope others on
Statalist will weigh in):

su e2
loc e2var=r(Var)
su v2
loc v2var=r(mean)
loc r=(`e2var'-`v2var')/`e2var'
eivreg e1 e2 [aw=v1], r(e2 `r')

but note that above I am making no use of the
individual-observation-specific error variances you have.

On Thu, Dec 11, 2008 at 3:03 PM, Austin Nichols <austinnichols@gmail.com> wrote:
> Richard Valliant <rvalliant@survey.umd.edu>:
> Maybe you want:
>  rcal (e1=) (w: e2), suuinit(D)
> (i.e. leave out only the x not the =x)?
>
> On Thu, Dec 11, 2008 at 11:07 AM, Richard Valliant
> <rvalliant@survey.umd.edu> wrote:
>> I'm a new user who is trying to fit a simple measurement error model to
>> a set of estimates from two independent surveys.  The surveys are
>> measuring the same things.  My data look like
>>
>> (e1, v1) = set of 30 estimates and their variances from survey 1
>> (e2, v2) = set of 30 estimates and their variances from survey 2
>>
>> The model I want to fit is basic:
>> e1 = a + b*e2 + u1
>> e2 = E2 + u2     (u1 and u2 are the model errors, E2 is E(e2)  )
>>
>> I've tried:
>>  mkmat v2
>>  mat D = diag(v2)
>>  rcal (e1) (w: e2), suuinit(D)
>>
>> This gives "invalid syntax". If I put some arbitrary variable x in the
>> model (which I don't want), this works:
>>    rcal (e1=x) (w: e2), suuinit(D)
>>
>> But rcal apparently does not allow aweights to account for v1 =
>> var(e1).
>> Is there a way to use rcal or some other procedure to fit the model
>> above, accounting for the fact that I have (1) estimates of variance for
>> both e1 and e2 and (2) no covariates measured without error to put in
>> the model?
>
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```