Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
<pierrick.jan@art.admin.ch> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
Re: Re: st: robust estimation SUREG, |

Date |
Sun, 29 May 2011 20:14:18 +0200 |

Dear M. Pérez, Thanks a lot for your prompt reply and your very helpful suggestions and the corresponding stata code! As you mentioned the rreg does not have any "hascons" option, which is critical as the constant of the first model is dropped (due to perfect multicollinearity). To circumvent this problem, I first of all performed a robust regression for each equation taken independently. Then I generated the weights in a matrix and used these weights in the final step. The adapted program is shown below (the parts I added are marked with an @ at the end). Regards, Pierrick Jan - -- Begin code ---- sysuse auto, clear * Robust regression and weights generation @ rreg price weight trunk, genwt (w1) @ rreg length trunk, genwt (w2) @ * Benchmark sureg (price weight trunk) (length trunk) est store sur * Obtain errors reg price weight trunk predict e1, resid reg length trunk predict e2, resid * Obtain covariance cor e1 e2, cov mat s = r(C) mat i = I(_N) mat v = s#i * Generating a weights vector*@ mkmat w1, matrix (W1) @ mkmat w2, matrix (W2) @ matrix W = W1\W2 @ * Stack dependent gen zero=0 stack price weight trunk zero length zero zero trunk, into(y weight trunk trunk2) clear gen cons1 =(_stack==1) gen cons2 =(_stack==2) * Transform variables mkmat weight trunk cons1 trunk2 cons2, matrix(X) drop weight trunk cons1 trunk2 cons2 matrix Xa=(cholesky(inv(v))'*X) svmat Xa, names(col) mkmat y drop y matrix ya=(cholesky(inv(v))'*y) svmat ya, names(col) * Introducing the weights of the robust regressions in the dataset @ svmat W, names(wrreg) @ reg y weight trunk cons1 trunk2 cons2, hascons * Which is same as SUR, se needs adjustment est replay sur * Now run robust instead, does not have nocons option. Would have to modify the call to -reg- in rreg.ado rreg y weight trunk cons1 trunk2 cons2 * Alternative: perform a regression using the reg command and introduce the weights of the initial robust regressions @ reg y weight trunk cons1 trunk2 cons2 [aweight = wrreg], hascons @ - -- End code ---- _______________________ ----------------------------- Date: Sat, 28 May 2011 14:19:49 -0400 From: =?ISO-8859-1?Q?Jorge_Eduardo_P=E9rez_P=E9rez?= <perez.jorge@ur.edu.co> Subject: Re: st: robust estimation SUREG A geometric mean might be more appropiate, so the final weight is zero if any of them is zero. An alternative is to run the SUR manually, stacking the variables, correcting for the error covariance and estimating with -reg- at the end. In this case, you could do the last step with -rreg- instead of - -reg-. -rreg- does not allow a -nocons- option, so you would have to modify its call to -reg-. See the code below. - -- Begin code ---- sysuse auto, clear * Benchmark sureg (price weight trunk) (length trunk) est store sur * Obtain errors reg price weight trunk predict e1, resid reg length trunk predict e2, resid * Obtain covariance cor e1 e2, cov mat s = r(C) mat i = I(_N) mat v = s#i * Stack dependent gen zero=0 stack price weight trunk zero length zero zero trunk, into(y weight trunk trunk2) clear gen cons1 =(_stack==1) gen cons2 =(_stack==2) * Transform variables mkmat weight trunk cons1 trunk2 cons2, matrix(X) drop weight trunk cons1 trunk2 cons2 matrix Xa=(cholesky(inv(v))'*X) svmat Xa, names(col) mkmat y drop y matrix ya=(cholesky(inv(v))'*y) svmat ya, names(col) reg y weight trunk cons1 trunk2 cons2, hascons * Which is same as SUR, se needs adjustment est replay sur * Now run robust instead, does not have nocons option. Would have to modify the call to -reg- in rreg.ado rreg y weight trunk cons1 trunk2 cons2 - -- End code ---- _______________________ Jorge Eduardo Pérez Pérez On Sat, May 28, 2011 at 9:27 AM, pierrick.jan@art.admin.ch <pierrick.jan@art.admin.ch> wrote: > Thanks a lot for your answer!! I have also tried to perform a SUREG by introducing > the three sets of weights generated by the rreg command but I realized that it was not > possible. As you mention I would have to combine them somehow. However it is for me > not clear how to combine them. An arithmetic average is definitely not appropriate. I was > wondering if it would not be more appropriate to proceed as described hereafter. In a first step, > on the basis of each robust regression performed, I determine outliers (i.e. observations under a > certain threshold in terms of weight height). In a second step I exclude these outliers from the data set > and then perform the SUR regression. I am however not really satisfied with this solution. > > Pierrick Jan > __________________________________________________________________________ > > Date: Fri, 27 May 2011 12:47:38 -0400 > From: =?ISO-8859-1?Q?Jorge_Eduardo_P=E9rez_P=E9rez?= <perez.jorge@ur.edu.co> > Subject: Re: st: robust estimation SUREG > > You could use the -genwt- option in -rreg- to generate the weights > used in the robust regression, then use those weights in -sureg-. You > will have three sets of weights from your first three regressions, and > - -sureg- will only allow a set of weights, so you would have to combine > them somehow. > _______________________ > Jorge Eduardo Pérez Pérez * * 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/

**Follow-Ups**:**Re: Re: st: robust estimation SUREG,***From:*Jorge Eduardo Pérez Pérez <perez.jorge@ur.edu.co>

- Prev by Date:
**Re: st: need help with gllamm ordered probit models** - Next by Date:
**Re: st: simulated annealing** - Previous by thread:
**st: need help with gllamm ordered probit models** - Next by thread:
**Re: Re: st: robust estimation SUREG,** - Index(es):