estimateCounts {demest} | R Documentation

## Estimate counts and model from one or more noisy datasets.

### Description

Infer the contents of a demographic array, and fit a model describing the array, using one or more noisy datasets.

### Usage

    estimateCounts(
      model,
      y,
      exposure = NULL,
      dataModels,
      datasets,
      concordances = list(),
      filename = NULL,
      nBurnin = 1000,
      nSim = 1000,
      nChain = 4,
      nThin = 1,
      parallel = TRUE,
      nCore = NULL,
      outfile = NULL,
      nUpdateMax = 50,
      verbose = FALSE,
      useC = TRUE
    )

### Arguments

`model` | An object of class `SpecModel`, specifying the model to be fit.
`y` | An object of class `Counts` with the same structure as the counts to be estimated.
`exposure` | A `Counts` object specifying exposure or sample size.
`dataModels` | A list of objects of class `SpecModel` describing the relationship between the datasets and counts.
`datasets` | A named list of objects of class `Counts`.
`concordances` | A named list of `concordances`, which are applied to `y` before it is supplied to the corresponding data model.
`filename` | The name of a file where output is collected.
`nBurnin` | Number of iteration discarded before recording begins.
`nSim` | Number of iterations carried out during recording.
`nChain` | Number of independent chains to use.
`nThin` | Thinning interval.
`parallel` | Logical. If `TRUE` (the default), parallel processing is used.
`nCore` | The number of cores to use, when `parallel` is `TRUE`. If no value supplied, defaults to `nChain`.
`outfile` | Where to direct the ‘stdout’ and ‘stderr’ connection output from the workers when parallel processing. Passed to function `[parallel]{makeCluster}`.
`nUpdateMax` | Maximum number of iterations completed before releasing memory. If running out of memory, setting a lower value than the default may help.
`verbose` | Logical. If `TRUE` (the default) a message is printed at the end of the calculations.
`useC` | Logical. If `TRUE` (the default), the calculations are done in C. Setting `useC` to `FALSE` may be useful for debugging.

### Details

See the documentation for `estimateModel` for details on model output and on MCMC settings.

`dataModels` is a list of specificiations for data models, and `datasets` is a named list of datasets. The response for each data model must be the name of a dataset. See below for examples.

### See Also

`estimateModel`, `estimateAccount`

### Examples

    nat <- demdata::sim.admin.nat
    health <- demdata::sim.admin.health
    survey <- demdata::sim.admin.survey
    nat <- Counts(nat, dimscales = c(year = "Points"))
    health <- Counts(health, dimscales = c(year = "Points"))
    survey <- Counts(survey)
    y <- health + 10
    model <- Model(y ~ Poisson(mean ~ age + sex + region,
                               useExpose = FALSE))
    dataModels <- list(Model(nat ~ PoissonBinomial(prob = 0.98)),
                       Model(health ~ Poisson(mean ~ age)),
                       Model(survey ~ Binomial(mean ~ 1)))
    datasets <- list(nat = nat, health = health, survey = survey)
    filename <- tempfile()
    ## in a real example, nBurnin and nSim would be much larger
    ## Not run:
    estimateCounts(model = model,
                   y = y,
                   dataModels = dataModels,
                   datasets = datasets,
                   filename = filename,
                   nBurnin = 50,
                   nSim = 50,
                   nThin = 2,
                   nChain = 2,
                   parallel = FALSE)
    fetchSummary(filename)

    ## End(Not run)

[Package demest version 0.0.0.3.1 Index]