Skip to content

Commit

Permalink
tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
baddstats committed Jan 15, 2023
1 parent 800e803 commit a8c017f
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 38 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: spatstat.explore
Version: 3.0-5.001
Date: 2022-11-24
Version: 3.0-5.002
Date: 2023-01-15
Title: Exploratory Data Analysis for the 'spatstat' Family
Authors@R: c(person("Adrian", "Baddeley",
role = c("aut", "cre", "cph"),
Expand Down Expand Up @@ -55,7 +55,7 @@ Authors@R: c(person("Adrian", "Baddeley",
person("Hangsheng", "Wang",
role = "ctb"))
Maintainer: Adrian Baddeley <Adrian.Baddeley@curtin.edu.au>
Depends: R (>= 3.5.0), spatstat.data (>= 3.0), spatstat.geom (>= 3.0), spatstat.random (>= 3.0), stats, graphics, grDevices, utils, methods, nlme
Depends: R (>= 3.5.0), spatstat.data (>= 3.0), spatstat.geom (>= 3.0-4.009), spatstat.random (>= 3.0), stats, graphics, grDevices, utils, methods, nlme
Imports: spatstat.utils (>= 3.0), spatstat.sparse (>= 3.0), goftest (>= 1.2-2), Matrix, abind
Suggests: sm, maptools (>= 0.9-9), gsl, locfit, spatial, fftwtools (>= 0.9-8), spatstat.linnet (>= 3.0), spatstat.model (>= 3.0), spatstat (>= 3.0)
Additional_repositories: https://spatstat.r-universe.dev
Expand Down
2 changes: 1 addition & 1 deletion NEWS
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

CHANGES IN spatstat.explore VERSION 3.0-5.001
CHANGES IN spatstat.explore VERSION 3.0-5.002

OVERVIEW

Expand Down
6 changes: 2 additions & 4 deletions R/auc.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
##
## Calculate ROC curve or area under it
##
## $Revision: 1.15 $ $Date: 2022/05/22 04:08:02 $
## $Revision: 1.16 $ $Date: 2023/01/15 02:21:19 $

roc <- function(X, ...) { UseMethod("roc") }

Expand Down Expand Up @@ -41,11 +41,9 @@ rocModel <- function(lambda, nullmodel, ..., high) {
p <- seq(0,1,length=1024)
fobs <- ec(p)
FZ <- d$values$FZ
FZinverse <- quantilefun.ewcdf(FZ)
lambdavalues <- if(is.im(lambda)) lambda[] else unlist(lapply(lambda, "["))
F1Z <- ewcdf(lambdavalues, lambdavalues/sum(lambdavalues))
pZ <- get("y", environment(FZ))
qZ <- get("x", environment(FZ))
FZinverse <- approxfun(pZ, qZ, rule=2)
ftheo <- 1 - F1Z(FZinverse(1-p))
df <- data.frame(p=p, fobs=fobs, ftheo=ftheo, fnull=p)
result <- fv(df,
Expand Down
38 changes: 13 additions & 25 deletions R/cdftest.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# cdftest.R
#
# $Revision: 2.28 $ $Date: 2022/11/03 11:08:33 $
# $Revision: 2.33 $ $Date: 2023/01/15 03:23:28 $
#
#

Expand Down Expand Up @@ -199,9 +199,9 @@ spatialCDFframe <- function(model, covariate, ...,
yyy <- c(yyy, 1)
}
if(length(xxx) > 1) {
#' non-degenerate cdf
## replace by piecewise linear approximation
FZ <- approxfun(xxx, yyy, rule=2)
class(FZ) <- c("interpolatedCDF", class(FZ))
}
# now apply cdf
U <- FZ(ZX)
Expand All @@ -214,28 +214,13 @@ spatialCDFframe <- function(model, covariate, ...,
U <- pmax(0, pmin(1, U))
}

if(make.quantile.function) {
## right-continuous inverse of FZ
pZ <- get("y", environment(FZ))
qZ <- get("x", environment(FZ))
ok <- !duplicated(pZ)
qZ <- qZ[ok]
pZ <- pZ[ok]
if(length(qZ) > 1) {
FZinverse <- approxfun(pZ, qZ, rule=2)
} else {
## degenerate
FZinverse <- approxfun(c(0,1), rep(qZ, 2), rule=2)
}
} else FZinverse <- NULL ## to placate package checker

# pack up
stuff$values$FZ <- FZ
stuff$values$FZX <- FZX
stuff$values$U <- U
stuff$values$EN <- sumwts ## integral of intensity = expected number of pts
if(make.quantile.function)
stuff$values$FZinverse <- FZinverse
stuff$values$FZinverse <- quantilefun(FZ) ## right-continuous inverse of FZ
class(stuff) <- "spatialCDFframe"
return(stuff)
}
Expand Down Expand Up @@ -288,7 +273,9 @@ plot.cdftest <- function(x, ..., style=c("cdf", "PP", "QQ"),
lty=c(lty2char(lty),lty2char(lty0)))
},
PP={
# plot FZX o (FZ)^{-1}
## plot FZX o (FZ)^{-1}
## y-axis: sample probabilities i/n for i=1, .., n
## x-axis: corresponding reference probabilities P(Z < z_[i])
pX <- get("y", environment(FZX))
qX <- get("x", environment(FZX))
p0 <- FZ(qX)
Expand All @@ -305,16 +292,17 @@ plot.cdftest <- function(x, ..., style=c("cdf", "PP", "QQ"),
abline(0,1, lwd=lwd0, col=col0, lty=lty0)
},
QQ={
# plot (FZX)^{-1} o FZ
pZ <- get("y", environment(FZ))
qZ <- get("x", environment(FZ))
FZinverse <- approxfun(pZ, qZ, rule=2)
pX <- get("y", environment(FZX))
## plot (FZX)^{-1} o FZ
## x-axis: order statistics z_[i] of values at data points
## y-axis: quantiles of Z on window with probabilities i/n
qX <- get("x", environment(FZX))
pX <- get("y", environment(FZX))
FZinverse <- quantilefun(FZ)
qZX <- FZinverse(pX)
Zrange <- range(qZ, qX, qZX)
xlab <- paste("Theoretical quantile of", covname)
ylab <- paste("Observed quantile of", covname)
qZ <- get("x", environment(FZ))
Zrange <- range(qZ, qX, qZX)
do.call(plot.default,
resolve.defaults(
list(x=qZX, y=qX),
Expand Down
2 changes: 1 addition & 1 deletion inst/doc/packagesizes.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
date version nhelpfiles nobjects ndatasets Rlines srclines
"2022-05-25" "3.0-0" 224 500 0 30319 6183
"2022-11-08" "3.0-4" 226 507 0 30638 6295
"2022-11-24" "3.0-5.001" 226 507 0 30658 6295
"2023-01-15" "3.0-5.002" 226 507 0 30644 6295
2 changes: 2 additions & 0 deletions man/macros/defns.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
\newcommand{\ottmar}{Ottmar Cronie \email{ottmar@chalmers.se}}
\newcommand{\stephenEglen}{Stephen Eglen \email{S.J.Eglen@damtp.cam.ac.uk}}
\newcommand{\mehdi}{Mehdi Moradi \email{m2.moradi@yahoo.com}}
\newcommand{\yamei}{Ya-Mei Chang \email{yamei628@gmail.com}}
% Names with accents
\newcommand{\Bogsted}{\ifelse{latex}{\out{B\o gsted}}{Bogsted}}
\newcommand{\Cramer}{\ifelse{latex}{\out{Cram\'er}}{Cramer}}
Expand All @@ -37,5 +38,6 @@
\newcommand{\rmhInteractionsList}{\code{\link[MPKG]{AreaInter}}, \code{\link[MPKG]{BadGey}}, \code{\link[MPKG]{DiggleGatesStibbard}}, \code{\link[MPKG]{DiggleGratton}}, \code{\link[MPKG]{Fiksel}}, \code{\link[MPKG]{Geyer}}, \code{\link[MPKG]{Hardcore}}, \code{\link[MPKG]{Hybrid}}, \code{\link[MPKG]{LennardJones}}, \code{\link[MPKG]{MultiStrauss}}, \code{\link[MPKG]{MultiStraussHard}}, \code{\link[MPKG]{PairPiece}}, \code{\link[MPKG]{Penttinen}}, \code{\link[MPKG]{Poisson}}, \code{\link[MPKG]{Softcore}}, \code{\link[MPKG]{Strauss}}, \code{\link[MPKG]{StraussHard}} and \code{\link[MPKG]{Triplets}}}
%% Frequent references
\newcommand{\baddrubaturnbook}{Baddeley, A., Rubak, E. and Turner, R. (2015) \emph{Spatial Point Patterns: Methodology and Applications with R}. Chapman and Hall/CRC Press. }
\newcommand{\baddchangclustersim}{Baddeley, A. and Chang, Y.-M. (2023) Robust algorithms for simulating cluster point processes. \emph{Journal of Statistical Computation and Simulation}. To appear.}
13 changes: 9 additions & 4 deletions man/plot.fv.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@
\details{
This is the \code{plot} method for the class \code{"fv"}.

An object of class \code{"fv"} is a convenient way of storing several different
statistical estimates of a summary function; see \code{\link{fv.object}}.
The default behaviour, executed by \code{plot(x)}, displays these
different estimates as curves with different colours and line styles,
and plots a legend explaining them.

The use of the argument \code{fmla} is like \code{plot.formula}, but offers
some extra functionality.

Expand Down Expand Up @@ -232,16 +238,15 @@
plot(K, xlim=xlim, ylim=ylim)
plot(Kr, xlim=xlim, ylim=ylim)
par(opa)
# For a shortcut, try plot(anylist(K, Kr), equal.scales=TRUE)
}
\seealso{
\code{\link{fv.object}},
\code{\link[spatstat.explore]{Kest}}
}
\author{\adrian


\author{
\adrian
and \rolf

}
\keyword{spatial}
\keyword{hplot}
Expand Down

0 comments on commit a8c017f

Please sign in to comment.