Learn R Programming

REAT (version 3.0.3)

ripley: Ripley's K

Description

Analyzing point clustering with Ripley's K function

Usage

ripley(loc_df, loc_id, loc_lat, loc_lon, 
area, t.max, t.sep = 10, K.local = FALSE, 
ci.boot = FALSE, ci.alpha = 0.05, ciboot.samples = 100,
progmsg = FALSE, K.plot = TRUE, Kplot.func = "K",
plot.title = "Ripley's K", plotX = "t", 
plotY = paste(Kplot.func, "Observed vs. expected"), 
lcol.exp = "blue", lcol.emp = "red", lsize.exp = 1, 
ltype.exp = "solid", lsize.emp = 1, ltype.emp = "solid",
bg.col = "gray95", bgrid = TRUE, bgrid.col = "white", 
bgrid.size = 2, bgrid.type = "solid")

Arguments

loc_df

A data frame containing the points

loc_id

Column containing the IDs of the points in the data frame loc_df

loc_lat

Column containing the latitudes of the points in the data frame loc_df

loc_lon

Column containing the longitudes of the points in the data frame loc_df

area

Total area of the regarded region

t.max

Maximum distance

t.sep

Number of distance intervals

K.local

Logical arguments that indicates whether local K values are computed or not

ci.boot

Logical arguments that indicates whether bootstrap confidence intervals are computed or not

ci.alpha

Significance level of the bootstrap confidence intervals

ciboot.samples

No. of bootstrap samples

progmsg

Logical argument: Printing progress messages or not

K.plot

Logical argument: Plot K function or not

Kplot.func

Which function has to be plotted? K function (Kplot.func = "K"), L function (Kplot.func = "L") or H function (Kplot.func = "H")

plot.title

If K.plot = TRUE: Plot title

plotX

If K.plot = TRUE: name of the X axis

plotY

If K.plot = TRUE: name of the Y axis

lcol.exp

If K.plot = TRUE: color of the line representing the expected values

lcol.emp

If K.plot = TRUE: color of the line representing the empirical values

lsize.exp

If K.plot = TRUE: size of the line representing the expected values

lsize.emp

If K.plot = TRUE: size of the line representing the empirical values

ltype.exp

If K.plot = TRUE: type of the line representing the expected values

ltype.emp

If K.plot = TRUE: type of the line representing the empirical values

bg.col

if lc = TRUE (plot of Lorenz curve), bg.col defines the background color of the plot (default: "gray95")

bgrid

if lc = TRUE (plot of Lorenz curve), the logical argument bgrid defines if a grid is shown in the plot

bgrid.col

if lc = TRUE (plot of Lorenz curve) and bgrid = TRUE (background grid), bgrid.col defines the color of the background grid (default: "white")

bgrid.size

if lc = TRUE (plot of Lorenz curve) and bgrid = TRUE (background grid), bgrid.size defines the size of the background grid (default: 2)

bgrid.type

if lc = TRUE (plot of Lorenz curve) and bgrid = TRUE (background grid), bgrid.type defines the type of lines of the background grid (default: "solid")

Value

The function returns a list containing:

K

A data.frame containing the K/L/H/t values

K_local

A data.frame containing the local K values (if stated)

local_ci

A data.frame containing the local confidence intervals (if stated)

Details

Calculating and plotting of the K function and its derivations (L function, H function) and, optionally, bootstrap confidence intervals.

References

Kiskowski, M.A./Hancock, J. F./Kenworthy, A. (2009): “On the Use of Ripley's K-function and its Derivatives to Analyze Domain Size”. In: Biophysical Journal, 97, 4, p. 1095-1103.

Krider, R. E./Putler, R. S. (2013): “Which Birds of a Feather Flock Together? Clustering and Avoidance Patterns of Similar Retail Outlets”. In: Geographical Analysis, 45, 2, p. 123-149.

See Also

dist, dist.buf, dist.mat

Examples

Run this code
# NOT RUN {
data(GoettingenHealth1)
# general practitioners, psychotherapists and pharmacies

area_goe <- 1753000000
# area of Landkreis Goettingen (sqm)
area_nom <- 1267000000
# area of Landkreis Northeim (sqm)
area_gn <- area_goe+area_nom
sqrt(area_gn/pi)

# this takes some seconds
ripley(GoettingenHealth1[GoettingenHealth1$type == "phys_gen",], 
"location", "lat", "lon", area = area_gn, t.max = 30000, t.sep = 300)

ripley(GoettingenHealth1[GoettingenHealth1$type == "pharm",], 
"location", "lat", "lon", area = area_gn, t.max = 30000, t.sep = 300)

ripley(GoettingenHealth1[GoettingenHealth1$type == "psych",], 
"location", "lat", "lon", area = area_gn, t.max = 30000, t.sep = 300)
# }

Run the code above in your browser using DataLab