The left-hand side of the formula must have a time and place
specified. This is done by separating time from space expressions with
an @
sign.
Like this, the events are assumed to start at T0
and
continue forever.
If events have a start and finish time specified in data frame
columns, then put them in parentheses and separate with a minus sign
(-
). Think of this as showing the event as being active
from the first time to the second time:
If either of these terms is also an expression, then put it in parentheses. For example, suppose you have the start times of events that all have a fixed duration of 10 units. You could add a new column to your data frame - which was the start time column plus 10 - or you can express it in the formula:
Make sure you include the outer parentheses - this is not valid:
Everything on the left of the ~
refers to the
case data, and everything on the right of the ~
refers to the place data.
So if you have a variable that relates to the case event and wish to include it as a covariate, put it on the left. If you have variables that relate to the place where the event occurred and want to have that as a covariate, put it on the right.
For example, this formula will add a term for the age column from the case data to the model:
This formula will add an additional term for the soil type at the locations:
By default any explanatory variables contribute to the susceptibility
and infectivity of a case. To change this, wrap the term in
inf()
or sus()
. For example, this will only
use age to model the infectivity of a case, and only use the soil type
to model the susceptibility of a case in an area:
In some settings there is data from several independent “experiments”, and the likelihood for the whole data is the simple product of the individual likelihoods. To facilitate this, the formula may include a grouping term on the left-hand side to show which case events are grouped with each other.
For example, if annual surveys have been made of some events, and these need to be all modelled together, you could do:
where Survey
is a column in the case event data.
Groupings can be sums of more than one column, in which case the groups are formed from unique combinations of the column values. For example if survey years and seasons are an appropriate group, then this may be the correct formula:
Note that if you want to see if there is a season effect,
then Season
should appear on the left-hand side as an
explanatory variable:
Groupings can also be specified on the right side of the
formula ~
, and these again relate to the place
data. This then divides the data into separate geographic subsets which
contribute indepdently to the likelihood. This may be appropriate if the
data consists of spatially disparate (and hence independent) data sets
but you want to pool the data to get one estimate of the model
parameters.