msr(qscheme, discrete, density, check=TRUE)"quad" usually
    extracted from a fitted point process model).qscheme.qscheme."msr" that can be plotted
  by plot.msr.A signed measure is a classical mathematical object (Diestel and Uhl, 1977) which can be visualised as a collection of electric charges, positive and/or negative, spread over the plane. Electric charges may be concentrated at specific points (atoms), or spread diffusely over a region.
  An object of class "msr" represents a signed (i.e. real-valued)
  or vector-valued measure in the 
  Spatial residuals for point process models
  (Baddeley et al, 2005, 2008) take the form of a real-valued
  or vector-valued measure. The function
  residuals.ppm returns an object of
  class "msr" representing the residual measure.
  The function msr  would not normally be called directly by the
  user. It is the low-level creator function that
  makes an object of class "msr" from raw data.
  
  The first argument qscheme is a quadrature scheme (object of
  class "quad"). It is typically created by quadscheme or
  extracted from a fitted point process model using
  quad.ppm. A quadrature scheme contains both data points
  and dummy points. The data points of qscheme are used as the locations
  of the atoms of the measure. All quadrature points
  (i.e. both data points and dummy points)
  of qscheme are used as sampling points for the density
  of the continuous component of the measure.
  The argument discrete gives the values of the
  atomic component of the measure for each data point in qscheme.
  It should be either a numeric vector with one entry for each
  data point, or a numeric matrix with one row
  for each data point. 
  The argument density gives the values of the density
  of the diffuse component of the measure, at each
  quadrature point in qscheme.
  It should be either a numeric vector with one entry for each
  quadrature point, or a numeric matrix with one row
  for each quadrature point. 
  If both discrete and density are vectors
  (or one-column matrices) then the result is a signed (real-valued) measure.
  Otherwise, the result is a vector-valued measure, with the dimension
  of the vector space being determined by the number of columns
  in the matrices discrete and/or density.
  (If one of these is a $k$-column matrix and the other
  is a 1-column matrix, then the latter is replicated to $k$ columns).
  
  The class "msr" has methods for print,
  plot and [. 
  There is also a function Smooth.msr for smoothing a measure.
Baddeley, A., Moller, J. and Pakes, A.G. (2008) Properties of residuals for spatial point processes. Annals of the Institute of Statistical Mathematics 60, 627--649. Diestel, J. and Uhl, J.J. Jr (1977) Vector measures. Providence, RI, USA: American Mathematical Society.
plot.msr,
  Smooth.msr,
  [.msrX <- rpoispp(function(x,y) { exp(3+3*x) })
   fit <- ppm(X, ~x+y)
   
   rp <- residuals(fit, type="pearson")
   rp
   rs <- residuals(fit, type="score")
   rs
   colnames(rs)
   # An equivalent way to construct the Pearson residual measure by hand
   Q <- quad.ppm(fit)
   lambda <- fitted(fit)
   slam <- sqrt(lambda)
   Z <- is.data(Q)
   m <- msr(Q, discrete=1/slam[Z], density = -slam)
   mRun the code above in your browser using DataLab