# Compute Summary Statistics from Count Histories

### Description

This function extracts various summary statistics from count data of
various `unmarkedFrame`

and `unmarkedFit`

classes.

### Usage

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | ```
countHist(object, plot.freq = TRUE, ...)
## S3 method for class 'unmarkedFramePCount'
countHist(object, plot.freq = TRUE, ...)
## S3 method for class 'unmarkedFitPCount'
countHist(object, plot.freq = TRUE, ...)
## S3 method for class 'unmarkedFrameGPC'
countHist(object, plot.freq = TRUE, ...)
## S3 method for class 'unmarkedFitGPC'
countHist(object, plot.freq = TRUE, ...)
## S3 method for class 'unmarkedFrameMPois'
countHist(object, plot.freq = TRUE, ...)
## S3 method for class 'unmarkedFitMPois'
countHist(object, plot.freq = TRUE, ...)
## S3 method for class 'unmarkedFramePCO'
countHist(object, plot.freq = TRUE,
plot.seasons = FALSE, ...)
## S3 method for class 'unmarkedFitPCO'
countHist(object, plot.freq = TRUE,
plot.seasons = FALSE, ...)
## S3 method for class 'unmarkedFrameGMM'
countHist(object, plot.freq = TRUE,
plot.seasons = FALSE, ...)
## S3 method for class 'unmarkedFitGMM'
countHist(object, plot.freq = TRUE,
plot.seasons = FALSE, ...)
``` |

### Arguments

`object` |
an object of various |

`plot.freq` |
logical. Specifies if the count data (pooled across seasons) should be plotted. |

`plot.seasons` |
logical. Specifies if the count data should be plotted for each season separately. This argument is only relevant for data collected across more than a single season. |

`...` |
additional arguments passed to the function. |

### Details

This function computes a number of summary statistics in data sets
used for various *N*-mixture models including those of Royle
(2004a, b), Dail and Madsen (2011), and Chandler et al. (2011).

`countHist`

can take data frames of the
`unmarkedFramePCount`

, `unmarkedFrameGPC`

,
`unmarkedFrameMPois`

, `unmarkedFramePCO`

,
`unmarkedFrameGMM`

classes as input. For convenience, the
function can also extract the raw data from model objects of classes
`unmarkedFitPCount`

, `unmarkedFitGPC`

,
`unmarkedFitMPois`

, `unmarkedFitPCO`

, and
`unmarkedFitGMM`

. Note that different model objects using the
same data set will have identical values.

### Value

`countHist`

returns a list with the following components:

`count.table.full` |
a table with the frequency of each observed count. |

`count.table.seasons` |
a list of tables with the frequency of each season-specific count. |

`hist.table.full` |
a table with the frequency of each count history across the entire sampling period. |

`hist.table.seasons` |
a list of tables with the frequency of each count history for each primary period (season). |

`out.freqs` |
a matrix where the rows correspond to each sampling
season and where columns consist of the number of sites sampled in
season |

`out.props` |
a matrix where the rows correspond to each sampling
season and where columns consist of the proportion of sites in
season |

`n.seasons` |
the number of seasons (primary periods) in the data set. |

`n.visits.season` |
the maximum number of visits per season in the data set. |

### Author(s)

Marc J. Mazerolle

### References

Chandler, R. B., Royle, J. A., King, D. I. (2011) Inference about
density and temporary emigration in unmarked
populations. *Ecology* **92**, 1429–1435.

Dail, D., Madsen, L. (2011) Models for estimating abundance from
repeated counts of an open population. *Biometrics* **67**,
577–587.

Royle, J. A. (2004a) *N*-mixture models for estimating population
size from spatially replicated counts. *Biometrics* **60**,
108–115.

Royle, J. A. (2004b) Generalized estimators of avian abundance from
count survey data. *Animal Biodiversity and Conservation*
**27**, 375–386.

### See Also

`covDiag`

, `detHist`

, `countDist`

,
`Nmix.chisq`

, `Nmix.gof.test`

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ```
##modified example from ?pcount
## Not run:
if(require(unmarked)){
data(mallard)
mallardUMF <- unmarkedFramePCount(mallard.y, siteCovs = mallard.site,
obsCovs = mallard.obs)
##compute descriptive stats from data object
countHist(mallardUMF)
##run single season model
fm.mallard <- pcount(~ ivel+ date + I(date^2) ~ length + elev +
forest, mallardUMF, K=30)
##compute descriptive stats from model object
countHist(fm.mallard)
}
## End(Not run)
``` |