1

My code is:

gls(fish~data+temp+size, na.action=na.omit, data=???, correlation=corAR1(form=~Date))

I just want to know about the data argument because I have no idea what to put in it. I understand it is the variables of the gls but I don't exactly get what that translates to when using the formula.

I've tred looking at the manuals but it doesn't give me much more than its the variables of the gls which I suppose sounds obvious unless you've never done it before.

Thomas
  • 43,637
  • 12
  • 109
  • 140
Francesca
  • 101
  • 2
  • 3

1 Answers1

4

The data argument refers to the data.frame from which the variables in your formula are supposed to be drawn. This is consistent across all modelling functions in R (see for example ? lm; though you're not using a base package and haven't specified what package gls is coming from, so perhaps this is something different).

Thomas
  • 43,637
  • 12
  • 109
  • 140
  • 2
    One possible source of `gls` would be `nlme` package where `data` argument is consistent with the rest of the modeling functions. – Roman Luštrik Sep 10 '14 at 09:34
  • The data but can be used in other formula I just happen to be using gls. my problem was knowing what to put after the data= – Francesca Sep 10 '14 at 10:28
  • model1<-gls(Number.of.Fish~Julian.Date+Temperature+Size.Class,na.action=na.omit,data=mydata,correlation=corAR1(form=~Julian.Date)) Unfortunately still doesn't work. I keep getting an error message about the AR1: Error in Initialize.corAR1(X[[1L]], ...) : covariate must have unique values within groups for "corAR1" objects. I've found the other people trying to find the solution to this error but no one seems to know. – Francesca Sep 10 '14 at 12:26
  • 1
    @Francesca That sounds like you should post that issue as a new question. – Thomas Sep 10 '14 at 13:02