distance.split {chicane}R Documentation

distance.split

Description

Split interaction data into subsets that are large enough for the chicane model to be fit (see Details), based on distance. This step allows the distance term in the model to be fit in a piecewise linear fashion.

Usage

distance.split(
  interaction.data,
  distance.bins = NULL,
  min.rows.bin = 50,
  verbose = FALSE
)

Arguments

interaction.data

Data table of interaction data, typically from prepare.data

distance.bins

Number of distance bins desired. If NULL, a number is chosen to ensure that the negative binomial can be fit in all bins.

min.rows.bin

The minimum number of expected rows in a distance bin. Ignored if distance.bins is set

verbose

Logical indicating whether to print progress reports

Details

Fitting glm.nb fails when there is a lack of overdispersion in the data. The chicane method contains logic to catch these errors and instead fit a Poisson model. However, to avoid this happening more than necessary, an attempt is made to avoid distance splits that will clearly result in numerical errors. This includes bins of data where the count is the same for all rows, or a covariate is a perfect predictor of count.

Value

List where each element corresponds to a specified distance bin, and the final one corresponding to trans-interactions (if present)

Examples

data(bre80);
distance.split(bre80);


[Package chicane version 0.1.8 Index]