# Check for autocorrelation in residuals

### Description

Once a DSM has been fitted to data, this function can be used to check for autocorrelation in the residuals.

### Usage

1 2 3 4 |

### Arguments

`dsm.obj` |
a fitted dsm object. |

`Transect.Label` |
label for the transect (default: |

`Segment.Label` |
label for the segments (default: |

`max.lag` |
maximum lag to calulate at. |

`resid.type` |
the type of residuals used, see |

`fun` |
the function to use, by default |

`ylim` |
user defined limits in y direction. |

`subset` |
which subset of the data should the correlation function be calculated on? |

`...` |
other options to pass to |

### Value

a plot or a vector of `fun`

applied at the lags.

### Details

Within each `Transect.Label`

, segments will be sorted according to their `Segment.Labels`

. This may require some time to get right for your particular data. If one has multiple surveys where transects are revisited, for example, one may want to make `Transect.Label`

a unique transect-survey id. Neither label need to be included in the model, they must just be present in the `$data`

field in the model. This usually means that they have to be in the segment data passed to `dsm`

.

The current iteration of this function will only plot correlations nicely, other things are up to you but you can get the function to return the data (by assigning the result to an object).

If there are NA values in the residuals then the correlogram will not be calculated. This usually occurs due to NA values in the covariates (so the smoother will not have fitted values there). Code like 'any(is.na(dsm.obj$data))' might be helpful.

### Author(s)

David L. Miller

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 |