Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Weighted random effects -rfregk-


From   James J Walters <[email protected]>
To   [email protected]
Subject   Re: st: Weighted random effects -rfregk-
Date   Sat, 03 Jun 2006 00:24:31 -0400

Although I have never done this before, I was able to use the ASCII editor to make the changes to the rfregk.ado file you suggested. This did resolve the problem and the random effects weighted regression produced the expected results. This however leads me to anoher problem. The predict command is not available with either the -u- or -e- option after this regression. I am specifically intersted in the case by case residuals available after -xtreg-. Any thoughts?

Richard, thank you for your kind assistance.

----- Original Message -----
From: Richard Williams <[email protected]>
Date: Friday, June 2, 2006 11:00 pm
Subject: Re: st: Weighted random effects -rfregk-

> At 08:43 PM 6/2/2006, James J Walters wrote:
> >I downloaded and am trying to use the "rfregk" command with 
> >aweights. I have version 8.1. I keep getting a syntax error. The 
> >command aqnd error results are shown below. Am I doing something 
> >wrong? Any ideas regarding the fix?
> 
> OK, I looked at the ado file, and it appears to me that a couple 
> of 
> the lines got zapped somehow, as if somebody tried to edit it but 
> screwed it up.  Specifically, there are line breaks in the wrong 
> places and extraneous comment code.  Look for the little bit of 
> code 
> that starts with if "`weight'"!="" and replace it as follows:
> 
> if "`weight'"!="" {
>   by `ivar': replace ``i'' = 
> cond(`dup',sum(`w'[_n-1]*``i''[_n-1])/sum(`w'[_n-1]),``i'')
> }
> else {
>   by `ivar': replace ``i'' = cond(`dup',sum(``i''[_n-1])/(_n-
> 1),``i'')}
> 
> Before I do that, I get the same error you do.  After i do that, I 
> get the following:
> 
> . webuse grunfeld,clear
> 
> . rfregk invest kstock [aw = mvalue]
> 
>                                                  Random-effects 
> GLS regression
> sd(u_company)                =  168.1342               Number of 
> obs =     200
> sd(e_company_t)              =  101.4408                           
> n =      10
> sd(e_company_t + u_company)  =  196.3653                           
> T =      20
> 
> corr(u_company, X)           =  0 (assumed)            R-sq within 
>  =  0.7927
>                                                             
> between  =  0.4156
>                                                             
> overall  =  0.6350
> 
>                                                        chi2(  1)  
>   =  723.16
> (theta = 0.8663)                                         Prob > 
> chi2 =  0.0000
> 
> -------------------------------------------------------------------
> -----------
>       invest |      Coef.   Std. Err.      z    P>|z|     [95% 
> Conf. Interval]
> -------------+-----------------------------------------------------
> -----------
>       kstock |   .4407224   .0163889    26.89   0.000     
> .4086009     .472844
>        _cons |     170.61   54.55903     3.13   0.002     
> 63.67631    277.5438
> -------------------------------------------------------------------
> -----------
> 
> If you have trouble, I can also email you the revised ado file if 
> you want.
> 
> 
> 
> 
> -------------------------------------------
> Richard Williams, Notre Dame Dept of Sociology
> OFFICE: (574)631-6668, (574)631-6463
> FAX:    (574)288-4373
> HOME:   (574)289-5227
> EMAIL:  [email protected]
> WWW (personal):    http://www.nd.edu/~rwilliam
> WWW (department):    http://www.nd.edu/~soc 
> 
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
> 

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index