Skip to content

Commit

Permalink
Bug fix in lppm; add warnings about scaled distances
Browse files Browse the repository at this point in the history
  • Loading branch information
baddstats committed Jan 18, 2025
1 parent ef0a898 commit 718d397
Show file tree
Hide file tree
Showing 9 changed files with 82 additions and 7 deletions.
8 changes: 4 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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"),
Expand All @@ -25,8 +25,8 @@ Authors@R: c(person("Adrian", "Baddeley",
person("Ottmar", "Cronie",
role = "ctb"))
Maintainer: Adrian Baddeley <[email protected]>
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,
Expand Down
16 changes: 16 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions inst/doc/packagesizes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions inst/info/packagesizes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 12 additions & 0 deletions man/distfun.lpp.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -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}}.
Expand Down
11 changes: 11 additions & 0 deletions man/distmap.lpp.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -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.
}
Expand Down
11 changes: 11 additions & 0 deletions man/nndist.lpp.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
11 changes: 11 additions & 0 deletions man/pairdist.lpp.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -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}).
Expand Down
16 changes: 13 additions & 3 deletions tests/testsL.R
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -413,6 +413,7 @@ local({
Zmm <- intersect.lintess(X,Y)
Zum <- intersect.lintess(unmark(X),Y)
Zmu <- intersect.lintess(X,unmark(Y))

}

if(FULLTEST) {
Expand Down Expand Up @@ -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 $
#'


Expand Down Expand Up @@ -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 }
Expand Down

0 comments on commit 718d397

Please sign in to comment.