From 718d397b21499169c44fdf729ff20d7dfa1dceed Mon Sep 17 00:00:00 2001 From: Adrian Baddeley Date: Sat, 18 Jan 2025 11:48:37 +0800 Subject: [PATCH] Bug fix in lppm; add warnings about scaled distances --- DESCRIPTION | 8 ++++---- NEWS | 16 ++++++++++++++++ inst/doc/packagesizes.txt | 2 ++ inst/info/packagesizes.txt | 2 ++ man/distfun.lpp.Rd | 12 ++++++++++++ man/distmap.lpp.Rd | 11 +++++++++++ man/nndist.lpp.Rd | 11 +++++++++++ man/pairdist.lpp.Rd | 11 +++++++++++ tests/testsL.R | 16 +++++++++++++--- 9 files changed, 82 insertions(+), 7 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 81b0a4e..294c2e3 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: spatstat.linnet -Version: 3.2-3 -Date: 2024-11-19 +Version: 3.2-3.001 +Date: 2025-01-18 Title: Linear Networks Functionality of the 'spatstat' Family Authors@R: c(person("Adrian", "Baddeley", role = c("aut", "cre", "cph"), @@ -25,8 +25,8 @@ Authors@R: c(person("Adrian", "Baddeley", person("Ottmar", "Cronie", role = "ctb")) Maintainer: Adrian Baddeley -Depends: R (>= 3.5.0), stats, graphics, grDevices, methods, utils, spatstat.data (>= 3.1-4), spatstat.univar (>= 3.1-1), spatstat.geom (>= 3.3-4), spatstat.random (>= 3.3-2), spatstat.explore (>= 3.3-3), spatstat.model (>= 3.3-2) -Imports: Matrix, spatstat.utils (>= 3.1-1), spatstat.sparse (>= 3.1-0) +Depends: R (>= 3.5.0), stats, graphics, grDevices, methods, utils, spatstat.data (>= 3.1-4), spatstat.univar (>= 3.1-1), spatstat.geom (>= 3.3-4), spatstat.random (>= 3.3-2), spatstat.explore (>= 3.3-3), spatstat.model (>= 3.3-3.002) +Imports: Matrix, spatstat.utils (>= 3.1-2), spatstat.sparse (>= 3.1-0) Suggests: goftest, locfit, spatstat (>= 3.0) Description: Defines types of spatial data on a linear network and provides functionality for geometrical operations, diff --git a/NEWS b/NEWS index ec869c0..8a8c660 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,20 @@ + CHANGES IN spatstat.linnet VERSION 3.2-3.001 + +OVERVIEW + + o Bug fix in lppm. + +BUG FIXES + + o lppm + For models involving covariates of class 'lintess', the internal + structure of the fitted model was corrupted, leading to errors in + calculating properties of the fitted model, such as predict.lppm. + [Spotted by Andrea Gilardi.] + [Bug fix requires spatstat.model 3.3-3.002] + Fixed. + CHANGES IN spatstat.linnet VERSION 3.2-3 OVERVIEW diff --git a/inst/doc/packagesizes.txt b/inst/doc/packagesizes.txt index c6a3792..ee8921f 100755 --- a/inst/doc/packagesizes.txt +++ b/inst/doc/packagesizes.txt @@ -33,4 +33,6 @@ date version nhelpfiles nobjects ndatasets Rlines srclines "2024-02-04" "3.1-4" 148 312 0 12340 3270 "2024-03-24" "3.1-5" 148 312 0 12343 3270 "2024-07-09" "3.2-1" 148 324 0 12882 3270 +"2024-09-18" "3.2-2" 148 324 0 12882 3270 "2024-11-19" "3.2-3" 148 324 0 12980 3270 +"2025-01-18" "3.2-3.001" 148 324 0 12980 3270 diff --git a/inst/info/packagesizes.txt b/inst/info/packagesizes.txt index c6a3792..ee8921f 100755 --- a/inst/info/packagesizes.txt +++ b/inst/info/packagesizes.txt @@ -33,4 +33,6 @@ date version nhelpfiles nobjects ndatasets Rlines srclines "2024-02-04" "3.1-4" 148 312 0 12340 3270 "2024-03-24" "3.1-5" 148 312 0 12343 3270 "2024-07-09" "3.2-1" 148 324 0 12882 3270 +"2024-09-18" "3.2-2" 148 324 0 12882 3270 "2024-11-19" "3.2-3" 148 324 0 12980 3270 +"2025-01-18" "3.2-3.001" 148 324 0 12980 3270 diff --git a/man/distfun.lpp.Rd b/man/distfun.lpp.Rd index 14e36c9..9777ca0 100644 --- a/man/distfun.lpp.Rd +++ b/man/distfun.lpp.Rd @@ -60,6 +60,18 @@ It also belongs to the class \code{"linfun"} which has methods for \code{plot}, \code{print} etc. } +\section{Distance values}{ + The values returned by the distance function + \code{f <- distfun(X)} are distances, + expressed as multiples of the unit of length of the spatial + coordinates in \code{X}. + The unit of length is given by \code{\link{unitname}(X)}. + + Note that, if the unit of length in \code{X} is + a composite expression such as \sQuote{2 microns}, + then the values of \code{f} are expressed as multiples + of 2 microns, rather than being expressed in microns. +} \seealso{ \code{\link{linfun}}, \code{\link{methods.linfun}}. diff --git a/man/distmap.lpp.Rd b/man/distmap.lpp.Rd index f4f4d00..927a7db 100644 --- a/man/distmap.lpp.Rd +++ b/man/distmap.lpp.Rd @@ -35,6 +35,17 @@ nearest point of the pattern \code{X} (or the \eqn{k}-th nearest point of \code{X}). } +\section{Distance values}{ + The pixel values in the image \code{distmap(X)} are distances, + expressed as multiples of the unit of length of the spatial + coordinates in \code{X}. + The unit of length is given by \code{\link[spatstat.geom]{unitname}(X)}. + + Note that, if the unit of length in \code{X} is a composite + expression such as \sQuote{2 microns}, + then the values in \code{distmap(X)} are expressed as multiples + of 2 microns, rather than being expressed in microns. +} \seealso{ Generic function \code{\link[spatstat.geom]{distmap}} and methods. } diff --git a/man/nndist.lpp.Rd b/man/nndist.lpp.Rd index 10991bf..0b51783 100644 --- a/man/nndist.lpp.Rd +++ b/man/nndist.lpp.Rd @@ -61,6 +61,17 @@ for each entry of \code{k}. Entries are nonnegative numbers or infinity (\code{Inf}). } +\section{Distance values}{ + The values returned by \code{nndist(X)} are distances, + expressed as multiples of the unit of length of the spatial + coordinates in \code{X}. + The unit of length is given by \code{\link{unitname}(X)}. + + Note that, if the unit of length in \code{X} is a composite + expression such as \sQuote{2 microns}, + then the values of \code{nndist(X)} are expressed as multiples + of 2 microns, rather than being expressed in microns. +} \author{ \adrian } diff --git a/man/pairdist.lpp.Rd b/man/pairdist.lpp.Rd index 190a85b..96203c1 100644 --- a/man/pairdist.lpp.Rd +++ b/man/pairdist.lpp.Rd @@ -50,6 +50,17 @@ the argument \code{method} has no effect, and the distances are computed using an efficient C algorithm. } +\section{Distance values}{ + The values returned by \code{pairdist(X)} are distances, + expressed as multiples of the unit of length of the spatial + coordinates in \code{X}. + The unit of length is given by \code{\link{unitname}(X)}. + + Note that, if the unit of length in \code{X} is a composite + expression such as \sQuote{2 microns}, + then the values of \code{pairdist(X)} are expressed as multiples + of 2 microns, rather than being expressed in microns. +} \value{ A symmetric matrix, whose values are nonnegative numbers or infinity (\code{Inf}). diff --git a/tests/testsL.R b/tests/testsL.R index 579dd4d..36d621f 100644 --- a/tests/testsL.R +++ b/tests/testsL.R @@ -17,7 +17,7 @@ cat(paste("--------- Executing", # # Tests for lpp code # -# $Revision: 1.72 $ $Date: 2024/06/05 09:11:58 $ +# $Revision: 1.74 $ $Date: 2025/01/18 03:44:09 $ local({ @@ -376,7 +376,7 @@ local({ df <- data.frame(seg=1:ns, t0=0, t1=1, tile=letters[1:ns]) M <- data.frame(len=lengths_psp(S), ang=angles.psp(S)) V <- lintess(simplenet, df, marks=M) - + ## methods for class lintess U <- unmark(V) U <- unstack(V) @@ -413,6 +413,7 @@ local({ Zmm <- intersect.lintess(X,Y) Zum <- intersect.lintess(unmark(X),Y) Zmu <- intersect.lintess(X,unmark(Y)) + } if(FULLTEST) { @@ -710,7 +711,7 @@ reset.spatstat.options() #' #' Tests of lppm and class support #' -#' $Revision: 1.2 $ $Date: 2020/06/12 00:24:09 $ +#' $Revision: 1.3 $ $Date: 2025/01/18 03:43:52 $ #' @@ -767,6 +768,15 @@ local({ fit3e <- emend(fit3) } + if(FULLTEST) { + #' handling of lintess covariates + df <- data.frame(seg=1:10, t0=0, t1=1, tile=rep(c("A", "B"), 5)) + V <- lintess(simplenet, df) + X <- runiflpp(20, simplenet) + mod <- lppm(X ~ V) + Lam <- predict(mod) + } + #' fundamental utilities: #' spatialCovariateEvidence (was: evalCovar) ycoord <- function(x,y) { y }