For a quick fix see ?try, in particular the last example there.
Afraid I am no expert in gls (which, you might mention, is in
package nlme) to explain the real cause of the problem.
> -----Original Message-----
> From: Christoph Lehmann [mailto:christoph.lehmann at gmx.ch]
> Sent: 25 September 2003 12:32
> To: r-help at stat.math.ethz.ch
> Subject: [R] Error from gls call (package nlme)
>
>
> Security Warning:
> If you are not sure an attachment is safe to open please contact
> Andy on x234. There are 0 attachments with this message.
> ________________________________________________________________
>
> Hi
> I have a huge array with series of data. For each cell in the array I
> fit a linear model, either using lm() or gls()
>
> with lm() there is no problem, but with gls() I get an error:
>
> Error in glsEstimate(glsSt, control = glsEstControl) :
> computed gls fit is singular, rank 2
>
> as soon as there are data like this:
> > y1 <- c(0,0,0,0)
> > x1 <- c(0,1,1.3,0)
> > gls(y1~x1)
> Error in glsEstimate(glsSt, control = glsEstControl) :
> computed gls fit is singular, rank 2
>
> of course, this is not a problem for lm()
>
> > lm(y1~x1)
>
> Call:
> lm(formula = y1 ~ x1)
>
> Coefficients:
> (Intercept) x1
> 0 0
>
> I know, that such data does not make "sense" but it is possible,
that
> something like this occurs in my data-set. Since I call gls()
> for every
> cell of my array in a loop, I don't want such errors to occur, since
> this breaks my loop.
>
> what is the problem here? What are potential solutions?
>
> Many thanks
>
> Christoph
> --
> Christoph Lehmann <christoph.lehmann at gmx.ch>
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
Simon Fear
Senior Statistician
Syne qua non Ltd
Tel: +44 (0) 1379 644449
Fax: +44 (0) 1379 644445
email: Simon.Fear at synequanon.com
web: http://www.synequanon.com
Number of attachments included with this message: 0
This message (and any associated files) is confidential and\...{{dropped}}