Package ‘smerc’ April 20, 2018



Yüklə 234,58 Kb.
Pdf görüntüsü
səhifə2/7
tarix21.04.2018
ölçüsü234,58 Kb.
#39538
1   2   3   4   5   6   7

4

casewin


casewin

Determine case windows (circles)

Description

casewin determines the case windows (circles) for the Besag-Newell method.

Usage

casewin(d, cases, cstar)



Arguments

d

An n × n square distance matrix containing the intercentroid distance between



the n region centroids.

cases


A vector of length n containing the observed number of cases for the n region

centroids.

cstar

A non-negative integer indicating the minimum number of cases to include in



each window.

Details


Using the distances provided in

d, for each observation, the nearest neighbors are included in an

increasingly large window until at least

cstar cases are included in the window. Each row of d is

matched with the same position in

cases.


Value

Returns the indices of the regions in each case window as a list. For each element of the list, the

indices are ordered from nearest to farthest from each centroid (and include the starting region).

Author(s)

Joshua French

References

Besag, J. and Newell, J. (1991). The detection of clusters in rare diseases, Journal of the Royal

Statistical Society, Series A, 154, 327-333.

Examples

data(nydf)

coords = as.matrix(nydf[,c("longitude", "latitude")])

d = sp::spDists(coords, longlat = FALSE)

cwins = casewin(d, cases = nydf$cases, cstar = 6)



color.clusters

5

color.clusters



Color clusters

Description

color.clusters is a simple helper function that makes it easier to color clusters of regions pro-

duced by an appropriate method, e.g.,

scan.test or uls.test. Regions/clusters that are not part

of any cluster have no color.

Usage

color.clusters(x, col = 2:(length(x$clusters) + 1))



Arguments

x

An object of class scan produced by a function such as



scan.test.

col


A vector of colors to color the clusters in

x. Should have same length as the

number of clusters in

x.

Value



Returns a vector with colors for each region/centroid for the data set used to construct

x.

Author(s)



Joshua French

Examples


data(nydf)

coords = with(nydf, cbind(longitude, latitude))

out = scan.test(coords = coords, cases = floor(nydf$cases),

pop = nydf$pop, alpha = 0.12, lonlat = TRUE,

nsim = 49)

data(nypoly)

library(sp)

plot(nypoly, col = color.clusters(out))




6

dmst.test

dmst.test

Dynamic minimum spanning tree scan test

Description

dmst.test implements the Dynamic Minimum Spanning Tree scan test of Assuncao et al. (2006).

Starting with a single region as a current zone, new candidate zones are constructed by combining

the current zone with the connected region that maximizes the resulting likelihood ratio test statistic.

This is procedure repeated until the population or distance upper bound are reached. The same

procedure is repeated for each region. The maxima likelihood first scan test proposed by Yao et al.

(2011) is an independent variant of this, but only searches from the starting region that maximizes

the likelihood ratio scan statistic. The clusters returned are non-overlapping, ordered from most

significant to least significant. The first cluster is the most likely to be a cluster. If no significant

clusters are found, then the most likely cluster is returned (along with a warning).

Usage

dmst.test(coords, cases, pop, w, ex = sum(cases)/sum(pop) * pop, nsim = 499,



alpha = 0.1, nreport = nsim + 1, ubpop = 0.5, ubd = 0.5,

lonlat = FALSE, parallel = TRUE)

Arguments

coords


An n × 2 matrix of centroid coordinates for the regions.

cases


The number of cases observed in each region.

pop


The population size associated with each region.

w

A binary spatial adjacency matrix.



ex

The expected number of cases for each region. The default is calculated under

the constant risk hypothesis.

nsim


The number of simulations from which to compute the p-value.

alpha


The significance level to determine whether a cluster is signficant. Default is

0.10.


nreport

The frequency with which to report simulation progress. The default is

nsim+ 1,

meaning no progress will be displayed.

ubpop

The upperbound of the proportion of the total population to consider for a clus-



ter.

ubd


The upperbound for the radius of a cluster. This should be a proportion in (0, 1].

The value is the proportion of the maximum intercentroid distance between any

two locations in

coords. See Details.

lonlat

The default is



FALSE, which specifies that Euclidean distance should be used.If

lonlat is TRUE, then the great circle distance is used to calculate the inter-

centroid distance.

parallel


A logical indicating whether the test should be parallelized using the

parallel::mclapply function.

Default is

TRUE. If TRUE, no progress will be reported.




dmst.test

7

Details



The maximum intercentroid distance can be found by executing the command:

sp::spDists(as.matrix(coords), longlat = lonlat),

based on the specified values of

coords and lonlat.

Value

Returns a list of length two of class scan. The first element (clusters) is a list containing the signifi-



cant, non-ovlappering clusters, and has the the following components:

locids


The location ids of regions in a significant cluster.

pop


The total population in the cluser window.

cases


The observed number of cases in the cluster window.

expected


The expected number of cases in the cluster window.

smr


Standarized mortaility ratio (observed/expected) in the cluster window.

rr

Relative risk in the cluster window.



loglikrat

The loglikelihood ratio for the cluster window (i.e., the log of the test statistic).

pvalue

The pvalue of the test statistic associated with the cluster window.



The second element of the list is the centroid coordinates. This is needed for plotting purposes.

Author(s)

Joshua French

References

Assuncao, R.M., Costa, M.A., Tavares, A. and Neto, S.J.F. (2006). Fast detection of arbitrarily

shaped disease clusters, Statistics in Medicine, 25, 723-742.

Yao, Z., Tang, J., & Zhan, F. B. (2011). Detection of arbitrarily-shaped clusters using a neighbor-

expanding approach: A case study on murine typhus in South Texas. International journal of health

geographics, 10(1), 1.

See Also


scan.stat

,

plot.scan



,

scan.test

,

flex.test



,

uls.test


,

bn.test


Examples

data(nydf)

data(nyw)

coords = with(nydf, cbind(longitude, latitude))

## Not run:

out = dmst.test(coords = coords, cases = floor(nydf$cases),

pop = nydf$pop, w = nyw,

alpha = 0.12, lonlat = TRUE,

nsim = 5, ubpop = 0.1, ubd = 0.2)

data(nypoly)

library(sp)



Yüklə 234,58 Kb.

Dostları ilə paylaş:
1   2   3   4   5   6   7




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©genderi.org 2024
rəhbərliyinə müraciət

    Ana səhifə