Skip to content

Point pattern add covariates

4 messages · Rolf Turner, Jose Funes, Adrian Baddeley

#
On 24/07/12 01:26, Jose Funes wrote:
I'm afraid I don't understand what it is that you need to do.
What do you mean by "attach/add"?  In the example of the
"bei" data that you refer to, the images (covariates) "elev"
and "grad" are components of the list "bei.extra" which is
a separate object from the point pattern "bei".  The object
"bei.extra" is not "attached" to the object "bei" in any way.

Barry Rowlingson suggested that you might want to find the
values of a covariate associated with each point of a point
pattern.   The easiest way to do this is to use the (undocumented)
function "lookup.im()".

E.g.:

     em <- with(bei.extra,lookup.im(elev,bei$x,bei$y))
     gm <- with(bei.extra,lookup.im(grad,bei$x,bei$y))

Then you could "attach" these values to the point pattern as
*marks*:

     marks(bei) <- data.frame(elev=em,grad=gm)

Is this (anything like) what you want to do?

     cheers,

         Rolf Turner

P. S.  Adrian:  Do you think we should make "lookup.im()" into a 
*documented*
function?  I have found myself recommending its use to inquirers on more 
than
one occasion.

         R.