addvar(model, covariate, ...,
                   subregion=NULL,
                   bw="nrd0", adjust=1,
                   from=NULL, to=NULL, n=512,
                   bw.input = c("points", "quad"),
                   bw.restrict = FALSE,
                   covname, crosscheck=FALSE)"ppm").function(x,y), or a character string
    giving the name of a covariate that was supplied when
    the model was fitted."owin")
    specifying a subset of the spatial domain of the data.
    The calculation will be confined to the data in this subregion.density.default).density.default).density.default to
    control the number and range of values at which the function
    will be estimated.density.default.subregion."addvar" containing the coordinates
  for the added variable plot. There is a plot method."spatial" which contains
  the internal data: the computed values of the residuals,
  and of all relevant covariates,
  at each quadrature point of the model. It is an object of class
  "ppp" with a data frame of marks.  The argument model should be a fitted spatial point process
  model (object of class "ppm"). 
  The argument covariate
  identifies the covariate that is to be considered for addition to
  the model. It should be either a pixel image (object of class
  "im") or a function(x,y) giving the values of the
  covariate at any spatial location. Alternatively covariate
  may be a character string, giving the name of a covariate that was
  supplied (in the covariates argument to ppm)
  when the model was fitted, but was not used in the model.
  The result of addvar(model, covariate) is an object belonging
  to the classes "addvar" and "fv". Plot this object to
  generate the added variable plot. 
  
  Note that the plot method shows the pointwise significance bands
  for a test of the null model, i.e. the null hypothesis
  that the new covariate has no effect.
  The smoothing bandwidth is controlled by the arguments
  bw, adjust, bw.input and bw.restrict.
  If bw is a numeric value, then
  the bandwidth is taken to be adjust * bw.
  If bw is a string representing a bandwidth selection rule
  (recognised by density.default)
  then the bandwidth is selected by this rule.
  The data used for automatic bandwidth selection are
  specified by bw.input and bw.restrict.
  If bw.input="points"  (the default) then bandwidth selection is
  based on the covariate values at the points of the original point
  pattern dataset to which the model was fitted.
  If bw.input="quad" then bandwidth selection is
  based on the covariate values at every quadrature point used to
  fit the model.
  If bw.restrict=TRUE then the bandwidth selection is performed
  using only data from inside the subregion.
Harrell, F. (2001) Regression Modeling Strategies. New York: Springer.
Wang, P. (1985) Adding a variable in generalized linear models. Technometrics 27, 273--276.
parres,
  rhohat,
  rho2hat.X <-  rpoispp(function(x,y){exp(3+3*x)})
  model <- ppm(X, ~y)
  adv <- addvar(model, "x")
  plot(adv)
  adv <- addvar(model, "x", subregion=square(0.5))Run the code above in your browser using DataLab