Description Usage Arguments Value Details Author(s) Examples

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

1 2 3 4 |

`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 |

a plot or a vector of `fun`

applied at the lags.

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.

David L. Miller

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ```
library(Distance)
library(dsm)
# load the data, see ?mexdolphins
data(mexdolphins)
# fit a model
hr.model <- ds(distdata, max(distdata$distance),
key = "hr", adjustment = NULL)
mod1<-dsm(count~s(x,y), hr.model, segdata, obsdata)
# look at lag 1 differences up to a maximum of lag 9, using deviance
# residuals
dsm.cor(mod1, resid.type="deviance", max.lag=9,
Segment.Label="Sample.Label")
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.