Jan Quets <jan.qu...@ua.ac.be> writes: Hello all, thx for the input this far.
after having implemented the interesting code professor Baddeley suggested, it seems that 'sort(X$marks)' and 'sort(rvals)' are however not the same vectors, which they should be according to the proposed null model. I have looked at the code but could not solve the problem (converting a multitype point pattern to a marked point pattern) either, also I don't understand the piece of code: marks(X) <- rvals[marks(X)] well. Because rvals is an existing vector with existing values which represents marks Anyhow besides this, I would like to split an observed pattern into large (larger than median) and small (smaller than median) dots (2 types) (Which I've already done!), and compare interactions between both types using an 'alltypes-routine', for instance G or Gcross (Which I've already done!). In this way I would like to see the interaction between the large (larger than the median) dots and the small (smaller than the median) dots of the observed pattern (Which I've already done!), in relation to the envelopes of the newly null model which is proposed here (which I don't have already done, and don't know how to!). The predetermined number of points and the predetermined set of marks of the null model, come from the observed pattern (which is split in 2 types (small & large) later) Does anybody think this is possible? E.g. by changing the expression prof. Baddeley suggested in some way. I have been thinking about it, but could not find a solution this far, I'm relatively new to R. cheers, Jan. -----Original Message----- From: adrian.badde...@csiro.au [mailto:adrian.badde...@csiro.au] Sent: Fri 5/28/2010 2:04 PM To: r-sig-geo@stat.math.ethz.ch Cc: Quets Jan; adrian.badde...@csiro.au; r.tur...@auckland.ac.nz Subject: Re: existance of a specific non-overlapping marked spatial model in spatstat or other R package? Jan Quets <jan.qu...@ua.ac.be> writes: > I am looking for a specific non-overlapping marked spatial model for use as a > null model > for monte carle simulations with use of the 'envelope' function in spatstat. > the specific marked spatial model should: > *generate a spatial random pattern with a predetermined number of points > (with conditions set below) > *each point should be assigned a mark randomly out of a predetermined set of > marks > *these marks represent the radia of circular discs which should be drawn > around these points > (which act as centres) > *no discs should overlap If the 'predetermined set of marks' is a finite set of radii, then this is a special case of the multitype Strauss process, where you set the interaction distance between mark r1 and mark r2 to be r1+r2, and the interaction parameters gamma are all equal to zero. Suppose 'rvals' is a vector containing the desired radii, 'W' is the simulation window and 'b' is the base intensity. Then do m <- length(rvals) types <- 1:m rmat <- outer(rvals, rvals, "+") gmat <- matrix(0, m, m) mod <- rmhmodel(cif="straussm", par=list(beta=rep(b, m), gamma=gmat, radii=rmat), w=W) This defines the model. Then if you want simulations of exactly k points, sta <- rmhstart(n.start=k) con <- rmhcontrol(p=1) If you now call X <- rmh(mod, sta, con) you'll get a multitype point pattern with marks 1:m where mark j corresponds to radius rvals[j]. If you need to convert this to a marked point pattern with the radii as the marks, do something like marks(X) <- rvals[marks(X)] To use this in envelope(), set mapmarks <- function(X, v=rvals) { marks(X) <- v[marks(X)]; return(X) } expr <- expression(mapmarks(rmh(mod, sta, con))) then call envelope(....... simulate=expr) If the 'predetermined set of marks' is a continuous range of radii, then there does exist some code to do this, but it is not yet released in spatstat. Adrian Baddeley [[alternative HTML version deleted]] _______________________________________________ R-sig-Geo mailing list R-sig-Geo@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo