\documentclass[10pt]{article}
\usepackage{graphicx}
\usepackage{Sweave}
\usepackage{bm}
\usepackage[bottom=0.5cm, right=1.5cm, left=1.5cm, top=1.5cm]{geometry} 

% \VignetteIndexEntry{Bugs Fixed in Spatstat}

%  $Revision: 1.32 $ $Date: 2023/05/17 01:17:05 $

\newcommand{\pkg}[1]{\texttt{#1}}
\newcommand{\code}[1]{\texttt{#1}}
\newcommand{\R}{{\sf R}}
\newcommand{\spst}{\pkg{spatstat}}
\newcommand{\Spst}{\pkg{Spatstat}}

\begin{document}
\bibliographystyle{plain}

<<echo=FALSE,results=hide>>=
library(spatstat)
x <- read.dcf(file = system.file("DESCRIPTION", package = "spatstat"),
              fields = c("Version", "Date"))
sversion <- as.character(x[,"Version"])
sdate    <- as.character(x[,"Date"])
options(useFancyQuotes=FALSE)
@ 

\title{Bugs fixed in \spst}
\author{Adrian Baddeley, Rolf Turner and Ege Rubak}
\date{For \spst\ version \texttt{\Sexpr{sversion}}}
\maketitle

\thispagestyle{empty}

This vignette lists all \emph{important} bugs detected and fixed in the
\spst\ package since 2010. It also explains how to search the list of
all recorded bugs in the \spst\ family of packages.

<<echo=FALSE,results=hide>>=
nbugs      <- nrow(bugfixes("all",  show=FALSE))
nbugssince <- nrow(bugfixes("book", show=FALSE))
@ 

\tableofcontents

\pagebreak
\section{Bug history}

Thousands of bugs have been detected and fixed in \spst\ since it was
first released in 2001. We started recording the bug history in 2010.

\subsection{Documentation of bugs}

Bugs that may have affected the user are listed in the 
package \texttt{NEWS} file, and can be searched
using the \R\ command \texttt{news} or the \spst\ command \texttt{bugfixes}. 

To see the bugs which have just been fixed in the latest version of \spst, type 
<<eval=FALSE>>=
bugfixes
@ 
To see all bugs which were fixed after a particular version of \spst,
for example, bugs that were fixed in version \texttt{1.50-0} or later, type
<<eval=FALSE>>=
bugfixes(sinceversion="1.50-0")
@ 
To see all bugs in \spst\ that were fixed after a particular date,
for example 30 June 2017, type
<<eval=FALSE>>=
bugfixes(sincedate="2017-06-30")
@ 
To see all bugs fixed after the book \cite{baddrubaturn15} was written, type
<<eval=FALSE>>=
bugfixes("book")
@ 
To see all bugs in the entire recorded history of \spst, type
<<eval=FALSE>>=
bugfixes("all")
@ 
which currently produces a list of \Sexpr{nbugs} bugs,
of which \Sexpr{nbugssince} were detected after publication of the
book \cite{baddrubaturn15}.

\subsection{Bugs in the \texttt{spatstat} family of packages}

Recently \spst\ was divided into a family of sub-packages.
The command \texttt{bugfixes} now covers the bug history in 
all of these sub-packages. See the help for \texttt{bugfixes} 
for further details.

<<echo=FALSE,results=hide>>=
getstuff <- function(pkg) {
  x <- read.dcf(file=system.file("DESCRIPTION", package=pkg),
                fields=c("Version", "Date"))
  xversion <- as.character(x[,"Version"])
  xdate    <- as.character(x[,"Date"])
  data.frame(date=as.Date(xdate), package=pkg, version=xversion)
}
vtable <- do.call(rbind,
                  lapply(c("spatstat.utils",
                           "spatstat.data", 
                           "spatstat.sparse",
                           "spatstat.geom",
                           "spatstat.random",
                           "spatstat.explore",
                           "spatstat.model",
                           "spatstat.linnet",
                           "spatstat"),
                         getstuff))
@ 

The current versions of the \spst\ family of packages
(used to produce this document) are:

<<echo=FALSE>>=
print(vtable, row.names=FALSE)
@ 

\pagebreak
\section{List of bugs}

Following is a list of the {\bf most serious bugs}, 
in decreasing order of potential impact.

A bug is classified as ``serious'' if it produced incorrect results
without the user's knowledge.

Bugs which cause an error exit are not listed here, because 
the presence of a bug is obvious, and the bug would not have misled the user.

\newcommand\bugger[4]{%  
  \\  {} %
  {\small (Bug introduced in \texttt{spatstat {#1}}, {#2}; %
    fixed in \texttt{spatstat {#3}}, {#4})}%
}
\newcommand\bugin[4]{%  
  \\  {} %
  {\small (Bug introduced in \texttt{{#1}}, {#2}; %
    fixed in \texttt{{#3}}, {#4})}%
}
\newcommand\bugbefore[4]{%  
  \\  {} %
  {\small (Bug introduced before \texttt{{#1}}, {#2}; %
    fixed in \texttt{{#3}}, {#4})}%
}
\newcommand\bugalways[2]{\bugbefore{spatstat 1.19-0}{may 2010}{#1}{#2}}


  %%% LEVEL 1
\subsection{Serious Bugs, Always Wrong, Broad Impact} 

\begin{itemize}
\item \texttt{nncross.ppp}:
  Results were completely incorrect if $k > 1$.
  \bugger{1.31-2}{april 2013}{1.35-0}{december 2013}

\item \texttt{nncross.pp3}:
  Results were completely incorrect in some cases.
  \bugger{1.32-0}{august 2013}{1.34-0}{october 2013}

 \item \texttt{cdf.test.ppm}:
    Calculation of $p$-values was incorrect for Gibbs models: 
    $1-p$ was computed instead of $p$.
  \bugger{1.40-0}{december 2014}{1.45-2}{may 2016}

\item \texttt{Smooth.ppp}:
  Results of \verb!Smooth(X, at="points", leaveoneout=FALSE)!
  were completely incorrect.
  \bugger{1.20-5}{august 2010}{1.46-0}{july 2016}
  
\item \texttt{rmh}:
  
   \begin{itemize}
   \item Simulation was completely incorrect in the case of 
     a multitype point process with an interaction that does not depend
     on the marks, such as \verb!ppm(betacells, ~marks, Strauss(60))!
     due to a coding error in the \texttt{C} interface.
     \bugger{1.22-3}{march 2010}{1.22-3}{june 2011}
   \item 
     Simulation of the Area-Interaction model was completely incorrect.
     \bugger{1.23-6}{october 2011}{1.31-0}{january 2013}
   \item 
     Simulation of the Geyer saturation process was completely incorrect.
     \bugger{1.31-0}{january 2013}{1.31-1}{march 2013}
   \item 
     Simulation of the Strauss-Hard Core process was partially incorrect,
     giving point patterns with a slightly lower intensity.
     \bugger{1.31-0}{january 2013}{1.37-0}{may 2014}
   \item 
     Simulation of the \emph{multitype} hard core model
     was completely incorrect (the interaction was effectively removed,
     changing the model into a Poisson process).
     \bugger{1.31-0}{january 2013}{1.63-0}{january 2020}   
   \item
     The result of simulating a model with a hard core
     did not necessarily respect the hard core constraint,
     and simulation of a model with strong inhibition
     did not necessarily converge. 
     This only happened if the first order trend was large,
     the starting state (\texttt{n.start} or \texttt{x.start}) was not given,
     and the number of iterations \texttt{nrep} was not very large.
     It occurred because of a poor choice for the default starting state.
     {\small (Bug was present since about 2010.  
       Fixed in \texttt{spatstat 1.40-0}, december 2014)}
   \item 
     Simulation was incorrect in the case of an inhomogeneous multitype model
     with \texttt{fixall=TRUE} (i.e.\ with a fixed number of points 
     of each type) if the model was segregated (i.e.\ if different types
     of points had different first order trend). 
     The effect of the error was that all types of points
     had the same first order trend.
     {\small (Bug was present since about 2010.
       Fixed in \texttt{spatstat 1.43-0}, september 2015)}
  \item 
     Simulation of the Geyer saturation process was 
     incorrectly initialised, so that the results of a short run 
     (i.e. small value of \texttt{nrep}) were incorrect, 
     while long runs were correct.
     \bugger{1.17-0}{october 2009}{1.31-1}{march 2013}
   \end{itemize}

\item \texttt{nnmark, as.im.ssf}:
  If \code{marks(X)} was a matrix rather than a data frame,
  the results were completely incorrect.
  \bugger{1.32-0}{august 2013}{1.55-1}{april 2018}

 \item \texttt{rVarGamma}:
   Simulations were incorrect; they were generated using the wrong value
   of the parameter \texttt{nu.ker}.  
   \bugger{1.25-0}{december 2011}{1.35-0}{december 2013}

 \item \texttt{rCauchy}:
   Simulations were incorrect; they were generated using the wrong value
   of the parameter \texttt{omega}.
   \bugger{1.25-0}{december 2011}{1.25-2}{january 2012}
   
 \item \texttt{lppm}:
   For multitype patterns, the fitted model was completely incorrect
   due to an error in constructing the quadrature scheme.
   \bugger{1.23-0}{july 2011}{1.30-0}{december 2012}
   
 \item \verb![.lpp!:
   The local coordinate \texttt{seg} was completely incorrect,
   when \texttt{i} was a window.
   \bugger{1.31-2}{april 2013}{1.45-0}{march 2016}
   
 \item \texttt{lohboot}:  Implementation was completely incorrect.
   \bugger{1.26-1}{april 2012}{1.53-2}{october 2017}
   
 \item \texttt{leverage.ppm}, \texttt{influence.ppm}, \texttt{dfbetas.ppm}:
   Results were incorrect for non-Poisson processes
   due to a mathematical error.
   \bugger{1.25-0}{december 2011}{1.51-0}{may 2017}

 \end{itemize}
 
  %%% LEVEL 2
 \subsection{Serious Bugs, Often Completely Wrong, Moderate Impact}

 \begin{itemize}
 \item \texttt{pairdist.lpp}:
   Results could have been completely incorrect, due to an internal bug,
    if the linear network data was in the non-sparse representation.
    \bugbefore{spatstat 1.65-0}{december 2020}{spatstat.linnet 3.0-3}{january 2023}
    
 \item \texttt{matrixsqrt}, \texttt{matrixinvsqrt}, \texttt{matrixpower}:
    If the result was a complex-valued matrix, the values were completely 
    incorrect.
    \bugin{spatstat 1.48-0}{december 2016}{spatstat.sparse 2.1-1}{february 2021}

  \item \texttt{pcf.ppp}:
    Estimates were incorrectly scaled (they were incorrectly multiplied
    by the area of the window.) Spotted by Maximilian Hesselbarth.
    \bugin{spatstat.explore 3.0-0}{may 2022}{spatstat.explore 3.0-6}{january 2023}
    
  \item \texttt{rLGCP}, \texttt{simulate.kppm}:
    Simulation results for log-Gaussian Cox processes were incorrect
    unless the pixel dimensions and pixel spacings were identical
    on the horizontal and vertical axes. (If pixel dimensions were not
    specified, then the results were incorrect whenever the Frame of the
    simulation window was not a square.) 
   \bugger{1.22-2}{june 2011}{1.65-0}{december 2020}   

  \item \texttt{deviance.lppm}, \texttt{pseudoR2.lppm}:
    Results were completely incorrect, due to a coding error.
   \bugger{1.44-0}{december 2015}{1.64-2}{november 2020}   

  \item \texttt{kppm}: 
    Results were sometimes incorrect for method='clik2' and method='palm'
    because the log composite likelihood was erroneously truncated to
    positive values. Any fitted model for which \verb!logLik(model) = 2.2e-16!
    should be suspected of being incorrect.
    \bugin{spatstat.core 2.0-0}{march 2021}{spatstat.core 2.3-2}{november 2021}   
    
 \item \texttt{bw.pcf}:
   Results were totally incorrect due to a typo.
   \bugger{1.51-0}{may 2017}{1.52-0}{august 2017}   

  \item \texttt{density.ppp}: 
    edge correction factors were calculated incorrectly when
    the window was not a rectangle, causing a negative bias in
    the estimated intensity.
    \bugger{1.57-0}{oct 2018}{1.64-0}{april 2020}.
    
 \item \texttt{density.ppp}:
   The standard error (calculated when \texttt{se=TRUE})
   was incorrect when \texttt{sigma} was a single numeric value.
   The output was equal to \texttt{sqrt(sigma)} times the correct answer.
   \bugger{1.41-1}{february 2015}{1.57-0}{october 2018}   
   
 \item \texttt{density.ppp}:
   The standard error (calculated when \texttt{se=TRUE})
   was incorrect for non-Gaussian kernels.
   \bugbefore{spatstat 1.57-0}{october 2018}{spatstat.explore 3.2-0}{may 2023}
  
 \item \texttt{relrisk.ppp}:
   The standard error (calculated when \texttt{se=TRUE})
   was incorrect for non-Gaussian kernels.
   \bugbefore{spatstat 1.57-0}{october 2018}{spatstat.explore 3.2-0}{may 2023}
  
  \item \texttt{rthin}:
   If \texttt{P} was close to 1, the result was sometimes an empty point pattern
   when it should have been identical to \texttt{X}.
   \bugger{1.43-0}{october 2015}{1.57-0}{october 2018}   
   
 \item \texttt{predict.mppm}:
   If the model included random effects, and if the library \pkg{MASS} was not loaded,
   the predictions were on the log scale (i.e.\ they were logarithms of the correct values).
   \bugger{1.43-0}{october 2015}{1.55-1}{april 2018}   
   
 \item \texttt{nnmap}, \texttt{nnmark}:
   Values were incorrect if the resulting pixel image
    had unequal numbers of rows and columns.
   \bugger{1.35-0}{december 2013}{1.55-0}{january 2018}   

 \item \texttt{vcov.mppm}:
    Format was incorrect (rows/columns were omitted) in some cases.
   \bugger{1.45-1}{may 2016}{1.55-0}{january 2018}   

  \item \texttt{model.matrix.ppm}, \texttt{model.frame.ppm}:
    Values were sometimes incorrect when applied to the result of
    \texttt{subfits}.
    To be precise, if \texttt{fit} was an \texttt{mppm}
    object fitted to a hyperframe
    that included ``design covariates'' (covariates that take a constant value
    in each row of the hyperframe), and if \verb!futs <- subfits(fit)!, then
    \verb!model.matrix(futs[[i]])! gave incorrect values in the columns
    corresponding to the design covariates. 
    \bugger{1.45-1}{may 2016}{1.55-0}{january 2018}   
   
 \item \texttt{predict.rhohat}, \texttt{simulate.rhohat}:
   Results were incorrect for a \texttt{rhohat} object computed
   from linear network data (class \texttt{"lpp"} or \texttt{"lppm"}).
   \bugger{1.31-0}{march 2013}{1.63-1}{february 2020}   

 \item \texttt{predict.rho2hat}:
   Results were incorrect for a \texttt{rho2hat} object computed
   from a point pattern.
   \bugger{1.42-0}{may 2015}{1.52-0}{august 2017}   

\item \texttt{density.ppp}:
  Result was incorrect for non-Gaussian kernels when
  \texttt{at="points"} and \texttt{leaveoneout=FALSE}.
   \bugger{1.47-0}{october 2016}{1.57-0}{october 2018}   
  
\item \texttt{envelope.ppm}:
   If the model was an inhomogeneous Poisson process, 
   the resulting envelope object was incorrect
   (the simulations were correct, but the envelopes were calculated
   assuming the model was CSR). 
   \bugger{1.23-5}{september 2011}{1.23-6}{october 2011}

 \item \texttt{linearK}, \texttt{linearpcf},
   \texttt{linearKinhom}, \texttt{linearpcfinhom}
   and multitype versions:
    These functions were sometimes greatly underestimated
    when the network had segments shorter than 10 coordinate units.
   \bugger{1.44-0}{december 2015}{1.46-2}{july 2016}

 \item \texttt{nncross}, \texttt{distfun}, \texttt{AreaInter}:
  Results of \texttt{nncross} were possibly incorrect 
  when \code{X} and \code{Y} did not have the same window. 
  This bug affected values of \texttt{distfun} and may also 
  have affected ppm objects with interaction \texttt{AreaInter}.
  \bugger{1.9-4}{june 2006}{1.25-2}{january 2012}

 \item \texttt{update.kppm}:
   \begin{itemize}
   \item Did not function correctly when several additional arguments
     were given.
     \bugger{1.42-2}{june 2015}{1.54-0}{november 2017}
   \item 
  If the call to \texttt{update} did not include a formula argument
   or a point pattern argument, then all arguments were ignored. 
   Example: \texttt{update(fit, improve.type="quasi")} was identical to 
   \texttt{fit}.
   \bugger{1.42-2}{june 2015}{1.45-0}{march 2016}
   \end{itemize}

  \item \texttt{markcorrint}:
   Results were completely incorrect.
   \bugger{1.39-0}{october 2014}{1.40-0}{december 2014}

    \item \texttt{leverage.ppm}, \texttt{influence.ppm}, \texttt{dfbetas.ppm}:
   Results were slightly incorrect for models with a hard core,
   due to a mathematical error.
   \bugger{1.51-0}{may 2017}{1.55-1}{april 2018}

    \item \texttt{Ops.msr}:
    If the input data contained a pixel image of the smoothed density,
    this image was not updated; it was copied to the output unchanged.
    Plots of the resulting measure were incorrect. 
    \bugger{1.52-0}{august 2017}{1.55-1}{april 2018}

  \item \verb![.linnet!: 
    in calculating \verb!L[W]! where \texttt{W} is a window,
    the code ignored segments of \code{L} that crossed \code{W}
    without having a vertex in \code{W}.
    \bugger{1.53-0}{september 2017}{1.55-1}{april 2015}
    
  \item \verb!as.im.function!:
    if the function domain was not a rectangle
    and the function values were categorical (factor) values,
    the result was an empty image.
    \bugger{1.42-0}{may 2015}{1.57-0}{october 2018}

  \item \texttt{density.lpp}:
    If \texttt{weights} were given, the results were completely incorrect
    if \texttt{leaveoneout=TRUE} (the default) and \texttt{at="points"}.
    \bugin{spatstat 1.51-0}{may 2017}{spatstat.linnet 3.0-0}{june 2022}
    
  \end{itemize}
  
  %%% LEVEL 3
  \subsection{Bugs, Substantially Incorrect, Moderate Impact}

  \begin{itemize}
  \item \texttt{closepairs.ppp}:
    If \texttt{distinct=FALSE} and \texttt{what="all"}, the resulting vectors
    \texttt{yi} and \texttt{yj} contained incorrect values, 
    and had the wrong length.
    \bugbefore{spatstat 1.56-0}{june 2018}{spatstat.geom 2.4-0}{march 2022}

  \item \texttt{nncross.ppp}:
    When \texttt{k > 1}, distance values were incorrectly replaced by
    \texttt{Inf} in some cases.
    \bugbefore{spatstat 1.56-0}{june 2018}{spatstat.geom 2.4-0}{march 2022}
    
  \item \texttt{nncross.ppp}:
    If the argument \texttt{by} was given, some of the results were incorrect.
    [Spotted by Hank Stevens.]
    \bugger{1.32-0}{august 2013}{2.2-0}{june 2021}
    
  \item \verb!"[<-.im"!:
    Incorrect values were assigned in \verb!x[] <- v! 
    when \texttt{x} and \texttt{v} were both factor-valued
    but with different sets of levels.
    \bugbefore{spatstat 1.56-0}{june 2018}{spatstat.geom 3.0-5}{january 2023}
     
 \item \texttt{vcov.mppm}:
    For Gibbs (non-Poisson) models, the variance matrix was
    calculated incorrectly in some cases. 
   \bugin{spatstat 1.45-1}{may 2016}{spatstat.core 2.4-1}{may 2022}   

 \item \texttt{vcov.mppm}:
    Results were sometimes incorrect if the two models
    had different interactions (e.g. Strauss vs Poisson).
   \bugin{spatstat 1.45-1}{may 2016}{spatstat.core 2.4-1}{may 2022}   

 \item \texttt{distmap.owin}:
   If the window was a binary mask, the distance values were
    slightly too large (by a factor \texttt{1 + 1/n} where \texttt{n}
    is the pixel grid dimension).
    \bugalways{spatstat.geom 2.4-0}{march 2022}
    
 \item \texttt{distfun.owin}:
   If the window was a binary mask, the distance values were
    slightly too small (typically reduced by 1/20 of a pixel width).
    \bugalways{spatstat.geom 2.4-0}{march 2022}
    
\item \texttt{nncross.ppp}, \texttt{nncross.pp3}:
  If \texttt{iX} and \texttt{iY} were given, some of the results were incorrect.
  \bugger{1.32-0}{august 2013}{2.2-0}{june 2021}

  \item \texttt{vcov.ppm}:
    Result was sometimes incorrect for Gibbs models.
    The Fisher information was slightly underestimated.
    \bugger{1.31-1}{march 2013}{1.64-1}{may 2020}
    
  \item \texttt{as.linnet.psp}:
    Sometimes produced a network with duplicated segments.
    [Such objects can be repaired using \texttt{repairNetwork}.]
     \bugger{1.41-1}{february 2015}{1.62-0}{december 2019}
    
   \item \texttt{addvar}:
    If the covariate contained \texttt{NA}, \texttt{NaN} or \texttt{Inf} values,
    the calculations were sometimes incorrect.
    \bugger{1.45-0}{march 2016}{.core 2.4-1}{march 2022}
    
    \item \texttt{rlpp}:
       The resulting pattern was unmarked 
       even when it should have been multitype.
       \bugger{1.48-0}{december 2016}{1.63-0}{january 2020}
       
 \item \texttt{spatialcdf}:
   Argument \texttt{weights} was ignored, unless it was a fitted model.
   {\small (Bug was present since about 2010.  
     Fixed in \texttt{spatstat 1.59-0}, march 2019)}

  \item \texttt{ppp}:
    Points inside the window were erroneously rejected as lying outside
    the window, if the window was a polygon equivalent to a rectangle
    with sides longer than $10^6$ units.
     {\small (Bug was present since the beginning.
       Fixed in \texttt{spatstat 1.59-0}, march 2019)}
    
  \item \texttt{inside.owin}:
    All results were \texttt{FALSE}
    if the window was a polygon equivalent to a rectangle
    with sides longer than $10^6$ units.
     {\small (Bug was present since the beginning.
       Fixed in \texttt{spatstat 1.59-0}, march 2019)}
     
   \item \texttt{sumouter}:
     result was incorrect (all entries were zero)
     if \texttt{w} was missing and \texttt{y} was given.
     \bugger{1.47-0}{october 2016}{1.59-0}{march 2019}
     
   \item \texttt{simulate.dppm}, \texttt{simulate.detpointprocfamily}:
    In dimensions higher than 2, the result was shifted so that
    it was centred at the origin.
    \bugger{1.54-0}{december 2017}{1.55-0}{january 2018}   

    \item \texttt{integral.msr}: If the result was a matrix, 
      it was the transpose of the correct answer.
    \bugger{1.35-0}{december 2012}{1.55-1}{april 2018}   
      
\item \texttt{density.ppp}:
  Values of \verb!density(X, at="points")!
  and \verb!Smooth(X, at="points")!
  were sometimes incorrect, due to omission of
  the contribution from the data point with the smallest $x$ coordinate.
  \bugger{1.26-0}{april 2012}{1.46-1}{july 2016}
  
  \item \texttt{multiplicity.default}:
    The first occurrence of any value in the input
    was incorrectly assigned a multiplicity of 1.
    \bugger{1.32-0}{december 2013}{1.57-1}{november 2018}   
    
 \item \texttt{update.ppm}:
   If the argument \texttt{Q} was given,
   the results were usually incorrect, or an error was generated.
   \bugger{1.38-0}{august 2014}{1.38-1}{august 2014}

\item \texttt{subfits}:
    The interaction coefficients of the submodels were incorrect
    for Gibbs models with a multitype interaction (\texttt{MultiStrauss}, etc).
   \bugger{1.35-0}{december 2013}{1.45-2}{may 2016}
   
\item \texttt{F3est}:
   Estimates of $F(r)$ for the largest value of $r$ 
   were wildly incorrect. 
     {\small (Bug was present since about 2010.
       Fixed in \texttt{spatstat 1.48-0}, december 2016)}
   
 \item \texttt{kppm}, \texttt{matclust.estpcf}, \texttt{pcfmodel}:
    The pair correlation function of the M\'atern Cluster Process
    was evaluated incorrectly at distances close to 0.
    This could have affected the fitted parameters 
    in \texttt{matclust.estpcf()} or \texttt{kppm(clusters="MatClust")}.
    \bugger{1.20-2}{august 2010}{1.33-0}{september 2013}
    
 \item \texttt{ppm}:
   Results were incorrect for the Geyer saturation model
   with a non-integer value of the saturation parameter \texttt{sat}.
   \bugger{1.20-0}{july 2010}{1.31-2}{april 2013}
   
 \item \texttt{clip.infline}: 
   Results were incorrect unless the midpoint of the window
   was the coordinate origin.
   \bugger{1.15-1}{april 2009}{1.48-0}{december 2016}
   
 \item \texttt{intensity.ppm}:
   Result was incorrect for Gibbs models if the model was 
    exactly equivalent to a Poisson process (i.e. if all interaction
    coefficients were exactly zero).
   \bugger{1.28-1}{june 2012}{1.47-0}{october 2016}
   
 \item \texttt{idw}: 
   Results were incorrect if 
   \texttt{se=TRUE} and \verb!at="pixels"! and 
   \texttt{power} was not equal to 2.
   The pixel values of \verb!$estimate! were all equal to zero.
   \bugger{1.58-0}{january 2019}{1.63-0}{january 2020}
   
 \item \texttt{funxy}: 
   Did not correctly handle one-line functions. 
   The resulting objects evaluated the wrong function in some cases.
   \bugger{1.45-0}{march 2016}{1.46-0}{july 2016}   

 \item \texttt{kernel.moment}:
   Result was incorrect for \texttt{kernel="cosine"} 
   and \texttt{kernel="optcosine"}.
   \bugger{1.45-2}{may 2016}{1.56-0}{june 2018}   
   
 \item \verb![.msr!:
   Format was mangled if the subset contained exactly one quadrature point.
   \bugger{1.21-3}{january 2011}{1.56-0}{june 2018}   

\item \texttt{hyperframe}:
  Did not correctly handle date-time values (columns of class \texttt{"Date"}, 
  etc).
     \bugger{1.19-1}{may 2010}{1.63-0}{january 2020}   
  
 \item \texttt{tess}:
    If a list of tiles was given, and the tiles were pixel images or masks,
    their pixel resolutions were ignored, and reset to the default 
    $128 \times 128$.
   {\small (Bug fixed in \texttt{spatstat 1.56-0}, june 2018)}   
   
 \item \texttt{nnorient}:
   crashed if the point pattern was empty.
   \bugger{1.40-0}{december 2015}{1.57-0}{october 2018}   

   \item \verb!as.im.data.frame!:
     Results were incorrect for factor-valued data.
    \bugger{1.45-2}{may 2016}{1.63-0}{january 2020}

  \item \texttt{predict.ppm}:
   Argument \texttt{new.coef} was ignored in calculating the standard error
   when \texttt{se=TRUE}.
   \bugin{spatstat 1.29-0}{october 2012}{spatstat.model 3.0-0}{june 2022}

 \item \texttt{predict.ppm}:
   Argument \texttt{new.coef} was ignored in calculating the standard error
   (and therefore the width of the interval) when \texttt{type="count"} and
   (\texttt{interval="confidence"} or \texttt{interval="prediction"}).
   \bugin{spatstat 1.29-0}{october 2012}{spatstat.model 3.0-0}{june 2022}

   \item \texttt{unnormdensity}:
     If \texttt{weights} was a single numerical value 
     \texttt{w}, the calculation incorrectly
    assigned the weight for each observation to be \texttt{w/n} where 
    \texttt{n=length(x)}.
    \bugalways{spatstat.geom 3.0-7}{march 2023}
 \end{itemize}   

 %% LEVEL 4: 
 \subsection{Partially Incorrect}
 \begin{itemize}
   
 \item \texttt{rjitter.ppp}: If \texttt{retry=FALSE}, marks were ignored.
   \bugbefore{spatstat 1.65-0}{december 2020}{spatstat.geom 3.0-5}{january 2023}
   
  \item \texttt{rhohat.lpp}:
    The argument \texttt{subset} was not handled correctly in the internal data.
    The estimated function \texttt{rho} was correct, but if
    \texttt{predict.rhohat} was applied,
    predictions were computed only in the \texttt{subset}, 
    and were possibly incorrect values.
    \bugbefore{spatstat 1.65-0}{december 2020}{spatstat.linnet 3.0-0}{june 2022}

  \item \texttt{rhohat.ppp}:
    The argument \texttt{subset} was not handled correctly in the internal data.
    The estimated function \texttt{rho} was correct, but if
    \texttt{predict.rhohat} was applied,
    predictions were computed only in the \texttt{subset}, 
    and were possibly incorrect values.
    \bugbefore{spatstat 1.65-0}{december 2020}{spatstat.explore 3.0-0}{june 2022}

 \item \texttt{density.lpp}:
   The result had the wrong length if \texttt{x} contained duplicated points
    when \texttt{weights} were given and \texttt{at="points"}.
    [Spotted by Andrea Gilardi]
    \bugger{1.55-1}{april 2018}{2.2-0}{june 2021}
    
  \item \texttt{crossdist.pp3}:
    Results with \texttt{periodic=TRUE} were partially incorrect.
    \bugger{1.34-1}{dec 2013}{1.65-0}{dec 2020}
    
 \item \texttt{mppm}:
   Internal data were malformed if the interaction was \texttt{Hardcore}
    or \texttt{MultiHard} or a hybrid involving these interactions.
    This caused various errors when the fitted model was used.
    \bugger{1.61-0}{september 2019}{1.64-0}{april 2020}.

 \item \texttt{mppm}:
   Ignored the arguments \texttt{nd} and \texttt{eps} controlling the 
   quadrature scheme. 
    \bugger{1.35-0}{december 2013}{1.64-0}{april 2020}.
    
  \item \texttt{edge.Ripley}:
    Results were incorrect for data points lying exactly at the corners
    of a rectangle.
    \bugbefore{spatstat 1.21-0}{november 2010}{spatstat.core 2.3-2}{november 2021}   

 \item \texttt{kppm}, \texttt{AIC}:
    For kppm models fitted with \verb!method='clik2'!, 
    the resulting value of \texttt{logLik()}
    was equal to $1/2$ of the correct value. This would have affected
    model comparison using AIC, and model selection using \texttt{step}.
    \bugger{1.42-0}{may 2015}{1.63-0}{january 2020}.
    
 \item \texttt{edge.Ripley}, \texttt{Kest}, \texttt{Kinhom}:
    Isotropic correction weights for polygonal windows were sometimes incorrect
    for small radius \texttt{r} if the polygon contained many small segments
    or if the polygon was very long and thin.
    \bugger{1.60-0}{june 2019}{1.62-0}{december 2019}.
    
 \item \texttt{edge.Ripley}, \texttt{Kest}, \texttt{Kinhom}:    
    Isotropic edge correction weight was computed incorrectly
    for a data point lying exactly on a corner of a rectangular window.
    \bugin{spatstat 1.60-0}{june 2019}{spatstat.explore 3.0-4}{november 2022}
 
 \item \texttt{beachcolours}, \texttt{beachcolourmap}:
   The number of colours was not always equal to \texttt{ncolours}.
   \bugger{1.32-0}{august 2013}{1.59-0}{march 2019}

 \item \texttt{extractbranch.lpp}:
   Point pattern coordinates were sometimes erroneously set to \texttt{NA}.
   \bugger{1.42-0}{may 2015}{1.59-0}{march 2019}
   
 \item \texttt{rotmean}:
       When \texttt{result="im"}
       the resulting image did not have the same dimensions
       as the input.
   \bugger{1.42-2}{june 2015}{1.58-0}{january 2019}   

 \item \texttt{quadratcount.ppp}:
   Sometimes issued an incorrect warning that data points were 
   outside the tessellation, when \texttt{tess} was a tessellation
   represented by a pixel image.
   {\small (Bug fixed in \texttt{spatstat 1.59-0}, march 2019)}   
   
 \item \texttt{quadrat.test}:
   the $p$-value was \texttt{NA} if one of the observed counts was zero,
   for the Cressie-Read tests with \texttt{CR} not equal to $1$ or $-1$.
   \bugger{1.38-0}{august 2014}{1.59-0}{march 2019}
   
 \item \texttt{quadrat.test}:
   argument \texttt{CR} was ignored if \texttt{method="MonteCarlo"}.
   \bugger{1.38-0}{august 2014}{1.61-0}{september 2019}
   
 \item \texttt{rotmean}:
    If argument \texttt{origin} was given, and if \texttt{result="im"}
    was specified,
    the resulting image was wrongly displaced.
   \bugger{1.42-2}{june 2015}{1.58-0}{january 2019}   

   
 \item \texttt{runifpointx}:
    Result was mangled when \texttt{n=0} or \texttt{n=1}.
   \bugger{1.50-0}{march 2017}{1.58-0}{january 2019}   
   
 \item \texttt{model.matrix.ppm}:
   The attribute \texttt{assign} was omitted in some cases.
   \bugger{1.45-1}{may 2016}{1.55-0}{january 2018}   

 \item \texttt{model.matrix.mppm}:
   Sometimes returned a matrix with the wrong number of rows.
   \bugger{1.55-0}{january 2018}{1.63-0}{january 2020}   

\item \texttt{density.ppp}:
  If the smoothing bandwidth \texttt{sigma} was very small 
  (e.g.\ less than the width of a pixel), 
  results were inaccurate if the default resolution was used,
  and completely incorrect if a user-specified resolution was given.
  \bugger{1.26-0}{april 2012}{1.52-0}{august 2017}
  
 \item \texttt{selfcrossing.psp}:
   $y$ coordinate values were incorrect.   
   \bugger{1.23-2}{august 2011}{1.25-3}{february 2012}
     
 \item \texttt{Geyer}:
   For point process models with the \texttt{Geyer} interaction, 
   \texttt{vcov.ppm} and \texttt{suffstat} sometimes gave incorrect answers.
   \bugger{1.27-0}{may 2012}{1.30-0}{december 2012}
   
 \item \texttt{leverage.ppm}, \texttt{influence.ppm}, \texttt{dfbetas.ppm}:
    Calculations were incorrect for a Geyer model fitted using
    an edge correction other than \texttt{"border"} or \texttt{"none"}.
   \bugger{1.25-0}{december 2011}{1.51-0}{may 2017}

 \item \texttt{leverage.ppm}, \texttt{influence.ppm}, \texttt{dfbetas.ppm}:
   Results were slightly incorrect for models fitted using the border
   correction.
   \bugger{1.25-0}{december 2011}{1.54-0}{november 2017}

 \item \texttt{leverage.ppm}:
   The mean leverage value (shown as a contour level in \texttt{plot.leverage.ppm})
   was slightly incorrect for Gibbs models.
   \bugger{1.25-0}{december 2011}{1.54-0}{november 2017}

 \item \texttt{vcov.ppm}, \texttt{suffstat}:
   These functions sometimes gave incorrect values 
   for marked point process models.   
   \bugger{1.27-0}{may 2012}{1.29-0}{october 2012}
   
 \item \texttt{diagnose.ppm}:
   When applied to a model obtained from \texttt{subfits()}, 
   in the default case (\texttt{oldstyle=FALSE}) 
   the variance calculations were incorrect.
   Consequently the dotted lines representing significance bands were 
   incorrect. An error or warning about negative variances occurred sometimes.
   However, calculations with \texttt{oldstyle=TRUE} were correct.
   The default has now been changed to \texttt{oldstyle=TRUE} for such models.
   \bugger{1.35-0}{december 2013}{1.45-0}{march 2016}

 \item \texttt{Smooth.ppp}:
   Results for \verb!at="points"! were garbled, for some values of 
   \texttt{sigma}, if \texttt{X} had more than one column of marks.
   \bugger{1.38-0}{october 2014}{1.46-0}{july 2016}
    
 \item \texttt{linearK}, \texttt{linearKinhom}:
   If any data points were located exactly at a vertex of the 
   linear network, the weights for Ang's correction were incorrect, 
   due to numerical error. This sometimes produced infinite 
   or NA values of the linear $K$ function.  
   \bugger{1.23-0}{july 2011}{1.27-0}{may 2012}

 \item \texttt{Kinhom}, \texttt{Linhom}:
   the results were not renormalised (even if \texttt{renormalise=TRUE})
   in some cases.
   \bugger{1.21-0}{december 2010}{1.37-0}{may 2014}
     
 \item \texttt{Kinhom}, \texttt{Linhom}:
   Ignored argument \texttt{reciplambda2} in some cases.
   \bugger{1.39-0}{october 2014}{1.40-0}{december 2014}

 \item \texttt{Kinhom}, \texttt{Linhom}:
   Calculations were incorrect if \texttt{lambda} was a fitted point
   process model.
   \bugger{1.38-0}{august 2014}{1.38-1}{august 2014}
     
 \item \texttt{integral.linim}, \texttt{integral.linfun}:
   \begin{itemize}
   \item 
   results were inaccurate because of a bias in the distribution of
   sample points.
   \bugger{1.41-0}{february 2015}{1.47-0}{october 2016}
   \item 
   results were inaccurate if many of the segment lengths were
   shorter than the width of a pixel.
   \bugger{1.41-0}{february 2015}{1.48-0}{december 2016}
    \item 
   results were wildly inaccurate in some extreme cases where many segments
   were very short.
   \bugger{1.41-0}{february 2015}{1.54-0}{november 2017}
   \end{itemize}
   
 \item \texttt{predict.ppm}:
   Calculation of the conditional intensity omitted the edge correction
   if \texttt{correction='translate'} or \texttt{correction='periodic'}. 
   \bugger{1.17-0}{october 2009}{1.31-3}{may 2013}

 \item \texttt{varblock}:
   Calculations were incorrect if more than one column of 
   edge corrections was computed. 
   \bugger{1.21-1}{november 2010}{1.39-0}{october 2014}
   
 \item \texttt{scan.test}
   Results were sometimes incorrect due to numerical instability
   (a 'Gibbs phenomenon').    
   \bugger{1.24-1}{october 2011}{1.26-1}{april 2012}

 \item \texttt{relrisk}:
   When \verb!at="pixels"!, a small fraction of pixel values were sometimes
   wildly inaccurate, due to numerical errors. This affected the 
   range of values in the result, and therefore the appearance of plots.
   {\small (Bug fixed in \texttt{spatstat 1.40-0}, december 2014)}

 \item \texttt{predict.slrm}:
   Results of \texttt{predict(object, newdata)} were incorrect 
   if the spatial domain of \texttt{newdata}
   was larger than the original domain.
   \bugger{1.21-0}{november 2010}{1.25-3}{february 2012}
   
 \item \texttt{Lest}:
   The variance approximations (Lotwick-Silverman and Ripley)
   obtained with \texttt{var.approx=TRUE} were incorrect for \texttt{Lest}
   (although they were correct for \texttt{Kest}) due to a coding error.
   \bugger{1.24-1}{october 2011}{1.24-2}{november 2011}
 
 \item \texttt{bw.diggle}:
   Bandwidth was too large by a factor of 2.
   \bugger{1.23-4}{september 2011}{1.23-5}{september 2011}
 
 \item pair correlation functions (\texttt{pcf.ppp}, \texttt{pcfdot}, 
    \texttt{pcfcross} etc:)
    The result had a negative bias at the maximum $r$ value,
    because contributions to the pcf estimate from interpoint distances
    greater than \texttt{max(r)} were mistakenly omitted. 
    {\small (Bugs fixed in \texttt{spatstat 1.35-0}, december 2013)}
    
 \item \texttt{Kest}, \texttt{Lest}:
   Gave incorrect values in very large datasets, due to numerical overflow.
   `Very large' typically means about 1 million points in a random pattern, 
   or 100,000 points in a tightly clustered pattern.
   [Overflow cannot occur unless there are at least 46,341 points.]
   
 \item \texttt{bw.relrisk}:
    Implementation of \texttt{method="weightedleastsquares"} was incorrect
    and was equivalent to \texttt{method="leastsquares"}.
    \bugger{1.21-0}{november 2010}{1.23-4}{september 2011}
    
\item \texttt{triangulate.owin}:
   Results were incorrect in some special cases.
   \bugger{1.42-2}{june 2015}{1.44-0}{december 2015}
  
\item \texttt{crosspairs}:
   If \texttt{X} and \texttt{Y} were identical point patterns,
   the result was not necessarily symmetric
   (on some machines) due to numerical artifacts.
   \bugger{1.35-0}{december 2013}{1.44-0}{december 2015}

 \item \texttt{bdist.tiles}:
   Values were incorrect in some cases due to numerical error.
    {\small (Bug fixed in \texttt{spatstat 1.29-0}, october 2012)}
   
\item \texttt{Kest.fft}:
  Result was incorrectly normalised.
   \bugger{1.21-2}{january 2011}{1.44-0}{december 2015}
  
\item \texttt{crossdist.ppp}:
  Ignored argument \texttt{squared} if \texttt{periodic=FALSE}.
    {\small (Bug fixed in \texttt{spatstat 1.38-0}, july 2014)}

\item polygon geometry:
    The point-in-polygon test gave the wrong answer in some boundary cases.
    {\small (Bug fixed in \texttt{spatstat 1.23-2}, august 2011)}

\item \texttt{MultiStraussHard}:
    If a fitted model with \texttt{MultiStraussHard} interaction was invalid,
    \texttt{project.ppm} sometimes yielded a model that was still invalid.
    {\small (Bug fixed in \texttt{spatstat 1.42-0}, may 2015)}
    
\item \texttt{pool.envelope}:  
  Did not always respect the value of \texttt{use.theory}.
    \bugger{1.23-5}{september 2011}{1.43-0}{september 2015}

\item \texttt{nncross.lpp}, \texttt{nnwhich.lpp}, \texttt{distfun.lpp}:
  Sometimes caused a segmentation fault.
    \bugger{1.44-0}{december 2015}{1.44-1}{december 2015}

\item \texttt{anova.ppm}:
  If a single \texttt{object} was given, and it was a Gibbs model,
  then \texttt{adjust} was effectively set to \texttt{FALSE}.
  \bugger{1.39-0}{october 2014}{1.44-1}{december 2015}

  \item \verb![.linim!: the result sometimes had the wrong class.
  \bugger{1.53-0}{september 2017}{1.55-1}{april 2015}

  \item \verb![.linim!: factor values were erroneously converted to 
    integers, in some cases.
  \bugger{1.53-0}{september 2017}{1.61-0}{september 2019}

\item \verb!is.subset.owin!: sometimes gave the wrong result for polygonal
  windows due to numerical rounding error.
   {\small (Bug was always present.
     Fixed in \texttt{spatstat 1.59-0}, march 2019)}

 \item \texttt{plot.tess}:  the legend showed the tile names
   in lexicographical order, rather than their original order.
   \bugger{1.55-1}{april 2018}{1.59-0}{march 2019}

  \item \texttt{rThomas}, \texttt{rMatClust},
    \texttt{rCauchy}, \texttt{rVarGamma}:
    If the simulation window was not a rectangle,
    the attribute \texttt{Lambda} was a numeric vector, 
    rather than a pixel image as intended.
    \bugger{1.43-0}{october 2015}{1.59-0}{march 2019}

  \item \texttt{effectfun}:
    In a multitype point process model, \texttt{effectfun} ignored any
    user-specified value of \texttt{marks}.
    \bugger{1.52-0}{august 2017}{1.61-0}{september 2019}

  \item \verb!"[<-.hyperframe"!:
    Some classes of objects were not handled correctly.
    \bugger{1.37-0}{may 2014}{1.61-0}{september 2019}

  \item \texttt{relrisk.ppp}:
    Crashed if there were more than 2 types of points
    and \texttt{method = "leastsquares"} or 
    \texttt{method = "weightedleastsquares"}.
    \bugger{1.23-4}{september 2011}{1.63-0}{january 2020}
    
  \item \texttt{nncross.ppp}:
    Format of output was incorrect if \texttt{X} was an empty pattern.
    \bugger{1.56-0}{june 2018}{1.63-0}{january 2020}
  
  \item \texttt{rmh}, \texttt{rmh.default}:
    For a marked point process, the debugger did not display the marks.
    (The \texttt{rmh} debugger is invoked by calling \texttt{rmh}
    with \texttt{snoop=TRUE}).
    \bugger{1.31-1}{march 2013}{1.63-0}{january 2020}
    
  \item \texttt{model.matrix.mppm}:
    If the model was fitted using \texttt{gam}, the resulting matrix
    did not have an \texttt{"assign"} attribute.
    \bugger{1.55-0}{march 2018}{2.2-0}{june 2021}
    
  \item \texttt{update.slrm}:
    Failed to find covariates that were provided in \texttt{env}.
    \bugger{1.33-0}{september 2013}{2.2-0}{june 2021}

   \item \texttt{distmap.owin}:
     Values were incorrect if X was an empty window 
     (\texttt{is.empty(X) = TRUE}).
     \bugalways{spatstat.geom 2.4-0}{march 2022}
    
   \item \texttt{distmap.ppp}, \texttt{distmap.psp}:
    Values were incorrect if X was an empty pattern (\texttt{npoints(X) = 0}).
     \bugalways{spatstat.geom 2.4-0}{march 2022}
    
   \item \texttt{distmap.psp}:
    Values were incorrect if X was an empty pattern (\texttt{nsegments(X) = 0}).
     \bugalways{spatstat.geom 2.4-0}{march 2022}
    
\end{itemize}

\begin{thebibliography}{1}
\bibitem{baddrubaturn15}
A. Baddeley, E. Rubak, and R. Turner.
\newblock {\em Spatial Point Patterns: Methodology and Applications with {{R}}}.
\newblock Chapman \& Hall/CRC Press, 2015.
\end{thebibliography}
 
\end{document}
