# \donttest{
library(spatstat.geom)
library(spatstat.random)
library(spatstat.explore)
library(spatstat.linnet)
#######################################
## 1. Planar point patterns (ppp)
#######################################
# ---------------------------------------------------------
# GLOBAL MARK CORRELATION (real-valued marks)
# ---------------------------------------------------------
X <- rpoispp(200)
marks(X) <- data.frame(m1 = runif(npoints(X), 1, 10))
ts1 <- testmc(X,
fun = mcorr.ppp,
fun_args = list(ftype = "stoyan", method = "density"))
plot(ts1)
# Global mark correlation (real-valued marks)
ts2 <- testmc(X,
fun = mcorrinhom.ppp,
fun_args = list(ftype = "stoyan",
method = "density",
method_lambda = "kernel"))
plot(ts2)
# Inhomogeneous global mark correlation (real-valued marks)
# ---------------------------------------------------------
# GLOBAL FUNCTIONAL MARK CORRELATION (function-valued marks)
# ---------------------------------------------------------
marks(X) <- data.frame(
t1 = runif(npoints(X), 1, 10),
t2 = runif(npoints(X), 1, 10),
t3 = runif(npoints(X), 1, 10),
t4 = runif(npoints(X), 1, 10),
t5 = runif(npoints(X), 1, 10)
)
ts3 <- testmc(X,
fun = fmcorr,
fun_args = list(ftype = "stoyan", method = "density"))
plot(ts3)
# Global functional mark correlation (function-valued marks)
ts4 <- testmc(X,
fun = fmcorrinhom,
fun_args = list(ftype = "stoyan",
method = "density",
method_lambda = "kernel",
bw = bw.scott))
plot(ts4)
# Inhomogeneous functional mark correlation (function-valued marks)
# ---------------------------------------------------------
# LOCAL MARK CORRELATION (real-valued marks)
# ---------------------------------------------------------
X <- rpoispp(200)
marks(X) <- data.frame(m1 = runif(npoints(X), 1, 10))
ts5 <- testmc(X,
fun = lmcorr.ppp,
fun_args = list(ftype = "stoyan", method = "density"))
plot(ts5[[1]])
# Local mark correlation (real-valued marks)
ts6 <- testmc(X,
fun = lmcorrinhom.ppp,
fun_args = list(ftype = "stoyan",
method = "density",
method_lambda = "kernel"))
plot(ts6[[1]])
# Inhomogeneous local mark correlation (real-valued marks)
# ---------------------------------------------------------
# LOCAL FUNCTIONAL MARK CORRELATION (function-valued marks)
# ---------------------------------------------------------
marks(X) <- data.frame(
t1 = runif(npoints(X), 1, 10),
t2 = runif(npoints(X), 1, 10),
t3 = runif(npoints(X), 1, 10),
t4 = runif(npoints(X), 1, 10),
t5 = runif(npoints(X), 1, 10)
)
ts7 <- testmc(X,
fun = lfmcorr,
fun_args = list(ftype = "stoyan", method = "density"))
plot(ts7[[1]])
# Local functional mark correlation (function-valued marks)
ts8 <- testmc(X,
fun = lfmcorrinhom,
fun_args = list(ftype = "stoyan",
method = "density",
method_lambda = "kernel",
bw = bw.scott))
plot(ts8[[1]])
# Inhomogeneous local functional mark correlation (function-valued marks)
#######################################
## 2. Linear network point patterns (lpp)
#######################################
Xl <- rpoislpp(40, simplenet)
# ---------------------------------------------------------
# GLOBAL MARK CORRELATION (real-valued marks)
# ---------------------------------------------------------
marks(Xl) <- data.frame(m1 = runif(npoints(Xl), 1, 10))
ts9 <- testmc(Xl,
fun = mcorr.lpp,
fun_args = list(ftype = "stoyan", method = "density"))
plot(ts9)
# Global mark correlation on linear networks (real-valued marks)
ts10 <- testmc(Xl,
fun = mcorrinhom.lpp,
fun_args = list(ftype = "stoyan",
method = "density",
method_lambda = "kernel"))
plot(ts10)
# Inhomogeneous global mark correlation on linear networks (real-valued marks)
# ---------------------------------------------------------
# GLOBAL FUNCTIONAL MARK CORRELATION (function-valued marks)
# ---------------------------------------------------------
marks(Xl) <- data.frame(
t1 = runif(npoints(Xl), 1, 10),
t2 = runif(npoints(Xl), 1, 10),
t3 = runif(npoints(Xl), 1, 10),
t4 = runif(npoints(Xl), 1, 10),
t5 = runif(npoints(Xl), 1, 10)
)
ts11 <- testmc(Xl,
fun = fmcorr,
fun_args = list(ftype = "stoyan", method = "density"))
plot(ts11)
# Global functional mark correlation on linear networks (function-valued marks)
ts12 <- testmc(Xl,
fun = fmcorrinhom,
fun_args = list(ftype = "stoyan",
method = "density",
method_lambda = "kernel",
bw = bw.scott.iso))
plot(ts12)
# Inhomogeneous global functional mark correlation on linear networks
# (function-valued marks)
# ---------------------------------------------------------
# LOCAL MARK CORRELATION (real-valued marks)
# ---------------------------------------------------------
marks(Xl) <- data.frame(m1 = runif(npoints(Xl), 1, 10))
ts13 <- testmc(Xl,
fun = lmcorr.lpp,
fun_args = list(ftype = "stoyan", method = "density"))
plot(ts13[[1]])
# Local mark correlation on linear networks (real-valued marks)
ts14 <- testmc(Xl,
fun = lmcorrinhom.lpp,
fun_args = list(ftype = "stoyan",
method = "density",
method_lambda = "kernel"))
plot(ts14[[1]])
# Inhomogeneous local mark correlation on linear networks (real-valued marks)
# ---------------------------------------------------------
# LOCAL FUNCTIONAL MARK CORRELATION (function-valued marks)
# ---------------------------------------------------------
marks(Xl) <- data.frame(
t1 = runif(npoints(Xl), 1, 10),
t2 = runif(npoints(Xl), 1, 10),
t3 = runif(npoints(Xl), 1, 10),
t4 = runif(npoints(Xl), 1, 10),
t5 = runif(npoints(Xl), 1, 10)
)
ts15 <- testmc(Xl,
fun = lfmcorr,
fun_args = list(ftype = "stoyan", method = "density"))
plot(ts15[[1]])
# Local functional mark correlation on linear networks (function-valued marks)
ts16 <- testmc(Xl,
fun = lfmcorrinhom,
fun_args = list(ftype = "stoyan",
method = "density",
method_lambda = "kernel",
bw = bw.scott.iso))
plot(ts16[[1]])
# Inhomogeneous local functional mark correlation on linear networks
# (function-valued marks)
# }
Run the code above in your browser using DataLab