Learn R Programming

scanstatistics (version 0.1.0)

score_locations: Score each location over zones and duration.

Description

For each location, compute the average of the statistic calculated for each space-time window that the location is included in, i.e. average the statistic over both zones and the maximum duration.

Usage

score_locations(x)

Arguments

x

An object of class scanstatistic.

Value

A data.table with the following columns:

location

The locations (as integers).

total_score

For each location, the sum of all window statistics that the location appears in.

n_zones

The number of spatial zones that the location appears in.

score

The total score divided by the number of zones and the maximum duration.

relative_score

The score divided by the maximum score.

Examples

Run this code
# NOT RUN {
# Simple example
set.seed(1)
table <- scanstatistics:::create_table(list(location = 1:4, duration = 1:4),
                                        keys = c("location", "duration"))
table[, mu := 3 * location]
table[, count := rpois(.N, mu)]
table[location %in% c(1, 4) & duration < 3, count := rpois(.N, 2 * mu)]
zones <- scanstatistics:::powerset_zones(4)
result <- scan_poisson(table, zones, 100)
score_locations(result)
# }

Run the code above in your browser using DataLab