[R] Manual two-stage least squares in R

Kevin Wright kw.stat at gmail.com
Tue Jan 25 22:28:08 CET 2011

Your question has some similarities this paper: Alison Smith, Brian
Cullis, and Arthur Gilmour. The analysis of crop variety evaluation
data in Australia. Aust. N. Z. J. Stat., 43:129--145, 2001.

In that paper, the authors fit a mixed model with several random
effects.  The variances are then held fixed while one of the model
terms is changed from a random effect to a fixed effect and the model
is re-fit using the constrained variances.  They refer to this as
"unshrinking" the BLUPs.  This is accomplished with ASREML or the R
version asreml-r, a commercial package (does have a 30-day free

Not sure if this would help you at all.

Good luck,

Kevin Wright

On Tue, Jan 25, 2011 at 2:47 PM, Katharina Ley <katley at umich.edu> wrote:
> Hi,
> I am trying to manipulate a gls regression model output to adjust for use of
> two-stage least squares. Basically, I want to estimate a model, then feed in
> a new set of residuals, then re-calculate all of the model output (i.e. the
> standard errors of the estimators, etc.). I have found some documentation on
> doing this in stata, which is below:
> http://www.stata.com/help.cgi?ereturn
> I am wondering whether there is a function like this ereturn() (see
> http://www.stata.com/help.cgi?ereturn) in R, and whether this might allow me
> to achieve something similar.
> Thanks so much!
>        [[alternative HTML version deleted]]
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

Kevin Wright

More information about the R-help mailing list