contact: Constructor of the basic contact object

Description Usage Arguments Details Value Note Author(s)

Description

This function constructs a ‘contact’ object, encoding a partially-observed process model together with a spatio-temporal date. As such, it is central to all the package's functionality. One implements the contact type model by specifying some or all of its basic components. These comprise:

kernelmodel,

which indicate the kenel to sample from;

r.process,

the simulator of the unobserved Markov state process;

d.process,

the evaluator of the probability density function for transitions of the unobserved Markov state process;

r.measure,

the simulator of the observed process, conditional on the unobserved state;

d.measure,

the evaluator of the measurement model probability density function;

r.prior,

which samples from a prior probability distribution on the parameters;

d.prior,

which evaluates the prior probability density function;

partrans,

which performs parameter transformations.

Usage

1
2
3
4
contact(data, rast, initializer, times, t0, ..., grid.lines, pop.grid,
  params, grid.size, age.level, nkernls, age.dist, t.max, t.intervention,
  kernelmodel, obsnames, statenames, paramnames, covarnames, zeronames,
  rmodel, r.model, PACKAGE, d.model)

Arguments

data

either a data frame holding the time series data, or an object of class ‘contact’, i.e., the output of another contact calculation.

rast

an object of class rasterlayer containing the landscape informationn.

initializer

the initial state contaning

row

The row at which the cell containing the host lies in

col

The column at which the cell containing the host lies in

typ

The type of the host (e.g. backyard 1 /plantation 0 hosts)

x

x-coordinate

y

y-coordinate

t_e

exposure time

t_i

infection time

times

the times at which observations are made. times must indicate the column of observation times by name or index. The time vector must be numeric and non-decreasing. Internally, data will be internally coerced to an array with storage-mode double.

t0

The zero-time, i.e., the time of the initial state. This must be no later than the time of the first observation, i.e., t0 <= times[1].

...

additional arguments supply new or modify existing model characteristics or components. See contact for a full list of recognized arguments.

When named arguments not recognized by contact are provided, these are made available to all basic components via the so-called userdata facility. This allows the user to pass information to the basic components outside of the usual routes of covariates (covar) and model parameters (params).

grid.lines

A 6 columns data frame with columns names as coor_x_1, coor_y_1, coor_x_2, coor_y_2, orient_line.

coor_x_1, coor_y_1

Coordinates of the left end point of the grid line

coor_x_2, coor_y_2

Coordinates of the right end point of the grid line

orient_line

Line orientation

  1. indicates horizontal orientation

  2. indicates vetical orientation

k_line

Line numbering: bottom to top, then left to right

pop.grid

Population density of the grid a case resides. This is filled from bottom to top, then left to right.

params

optional; named numeric vector of parameters. This will be coerced internally to storage mode double.

age.level, age.dist

Vectors of age level and the propportion of each age group respectively. See details.

obsnames

optional character vector; names of the observables. It is not usually necessary to specify obsnames since, by default, these are read from the names of the data variables.

statenames

optional character vector; names of the latent state variables. It is typically only necessary to supply statenames when C snippets are in use.

paramnames

optional character vector; names of model parameters. It is typically only necessary to supply paramnames when C snippets are in use.

covarnames

optional character vector; names of the covariates. It is not usually necessary to specify covarnames since, by default, these are read from the names of the covariates.

t_intervention

Start of the intervention if any.

EI_model

Take integer values to specify the type of model used for the latent period. See E_to_I

kern.

model Take integer values to specify the type of dispersal kernel used. See Samp_dis

r.process

simulator of the latent state process. Setting r.process=NULL removes the latent-state simulator.

d.process

optional; specification of the probability density evaluation function of the unobserved state process. Setting dprocess=NULL removes the latent-state density evaluator.

r.measure

simulator of the measurement model, specified either as a C snippet, an R function, or the name of a pre-compiled native routine available in a dynamically loaded library. Setting rmeasure=NULL removes the measurement model simulator.

d.measure

evaluator of the measurement model density, specified either as a C snippet, an R function, or the name of a pre-compiled native routine available in a dynamically loaded library. Setting dmeasure=NULL removes the measurement density evaluator.

r.prior

optional; prior distribution sampler, specified either as a C snippet, an R function, or the name of a pre-compiled native routine available in a dynamically loaded library. Setting rprior=NULL removes the prior distribution sampler.

d.prior

optional; prior distribution density evaluator, specified either as a C snippet, an R function, or the name of a pre-compiled native routine available in a dynamically loaded library. Setting dprior=NULL resets the prior distribution to its default, which is a flat improper prior.

partrans

optional parameter transformations, constructed using.

If a covariate table is supplied, then the value of each of the covariates is interpolated as needed. The resulting interpolated values are made available to the appropriate basic components. See the documentation for covariate_table for details.

verbose

logical; if TRUE, diagnostic messages will be printed to the console.

Details

Each basic component is supplied via an argument of the same name. These can be given in the call to contact, or to many of the package's other functions. In any case, the effect is the same: to add, remove, or modify the basic component.

Each basic component can be furnished using C snippets, R functions, or pre-compiled native routine available in user-provided dynamically loaded libraries.

Value

The contact constructor function returns an object, call it C, of class ‘contact’. C contains, in addition to the data, any elements of the model that have been specified as arguments to the contact constructor function. One can add or modify elements of C by means of further calls to contact, using C as the first argument in such calls. One can pass C to most of the contact package methods via their data argument.

Note

It is not typically necessary (or indeed often feasible) to define all of the basic components for any given purpose. Each contact algorithm makes use of only a subset of these components. Any algorithm requiring a component that is not present will generate an error letting you know that you have not provided a needed component. FIXME

Author(s)

Hola K. Adrakey


holaanna/contactsimulator documentation built on Dec. 2, 2019, 2:39 a.m.