Learn R Programming

dbmss (version 1.2.4)

RandomPosition.K: Simulations of a point pattern according to the null hypothesis of random position defined for K

Description

Simulations of a point pattern according to the null hypothesis of random position defined for K.

Usage

RandomPosition.K(X)

Arguments

X
A point pattern (ppp.object), marks must be a dataframe with two columns: PointType: labels, as factors. PointWeight: weights.

Value

  • A new point pattern (an object of class ppp.object).

Details

Points marks are kept unchanged and their position is drawn in a binomial process by runifpoint.

See Also

PopulationIndependence.K, PopulationIndependence.M, RandomLabeling.M

Examples

Run this code
# Simulate a point pattern with two types
X <- rpoispp(5) 
PointType   <- sample(c("A", "B"), X$n, replace=TRUE)
PointWeight <- runif(X$n, min=1, max=10)
X$marks <- data.frame(PointType, PointWeight)

par(mfrow=c(1,2))
plot(X, main="Original pattern, Point Type")

# Randomize it
Y <- RandomPosition.K(X)
# Invert the order of columns in mark to plot the point type, not the point weight
Y$marks <- data.frame(Y$marks$PointType, Y$marks$PointWeight)
# Points are randomly distributed
plot(Y, main="Randomized pattern, Point Type")

Run the code above in your browser using DataLab