0
$\begingroup$

I was trying to model fish catch (CPUE) using a combination of some categorical and numrical predictors. I have the data for 10 years. The data has been collected only in the period from June to September. My friend has suggested including an AR(1) term to get rid of the autoregressive error but he was unable to provide the exact solution. The first 10 rows of the data are given below. I tried to figure out the problem using forcast and nlme packages without success. Therefore, please suggest some solution /methods to this problem.

    Date        CPUE    Lunarphase   Rainfall WindSpeed WindDir Months
 01.08.13   25      WanCre      35.7         6.19   3.93    Aug
 02.08.13   18      WanCre       2.86        9.56   3.93    Aug
 03.08.13   25      WanCre      34          3.19    3.14    Aug
 04.08.13   31.7    WanCre      46.1         1.16   1.57    Aug
 05.08.13   18.3    WanCre      3.39         4.94   3.93    Aug
 08.08.13   14.6    NM          25           3.5    3.14    Aug
 09.08.13   12.2    NM          4.82        10.2    3.93    Aug
 10.08.13   16.2    WaxCre      13.8         7.2    3.93    Aug
 11.08.13   24.2    WaxCre      31.1         4.8    2.36    Aug
 12.08.13   15.7    WaxCre      16           3.8    3.93    Aug‍

$\endgroup$

1 Answer 1

2
$\begingroup$

A generalized least squares model should do the trick: in R, you can fit such a model with the gls() function in the nlme package, e.g.

gls(CPUE ~ <some variables>, correlation=corAR1(form= ~DOY|Year)

You'll have to use DOY (day-of-year) and Year (compute them from your Date variable) as a time covariate and grouping factor respectively because corAR1 can't deal with gaps in the data series.

?nlme::corAR1 says

form: a one sided formula of the form ‘~ t’, or ‘~ t | g’,
      specifying a time covariate ‘t’ and, optionally, a grouping
      factor ‘g’. When a grouping factor is present in
      ‘form’, the correlation structure is assumed to apply only to
      observations within the same grouping level; observations
      with different grouping levels are assumed to be
      uncorrelated ...
$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.