Alejandro Veen
2007-Jul-13 14:51 UTC
[R] spatstat - Fitting a Strauss model with trend determined by kernel density smoother
Dear r-help, I would like to use the 'ppm' function of the 'spatstat' package to fit a Strauss inhibition model. I understand that I can specify a parametric model for the "background" trend, but how would I specify a trend which is estimated using a Kernel density smoother? In particular, I would like to use the 'kde' function of the 'ks' package to estimate the "background" intensity and then use this as the trend for a Strauss inhibition process. Thanks already in advance, Alejandro Veen
Rolf Turner
2007-Jul-15 21:03 UTC
[R] spatstat - Fitting a Strauss model with trend determined by kernel density smoother
On 14/07/2007, at 2:51 AM, Alejandro Veen wrote:> Dear r-help, > > I would like to use the 'ppm' function of the 'spatstat' package to > fit a Strauss inhibition model. I understand that I can specify a > parametric model for the "background" trend, but how would I specify a > trend which is estimated using a Kernel density smoother? > > In particular, I would like to use the 'kde' function of the 'ks' > package to estimate the "background" intensity and then use this as > the trend for a Strauss inhibition process.Questions about a specific contributed package should usually be directed to the maintainers of that package rather than to r-help. To attempt to answer your question: You need to convert your estimate of the background trend to an ***image***; see the function im() in the spatstat package. Or instead of using kde, you could use the ppp method for density() which is provided in spatstat; this methop returns an image. See the help for density.ppp (). Now suppose that your point pattern is ``X'' and your estimate of the trend is ``bgim''. You can then fit the model you want via fit <- ppm(X,~bgim,inter=Strauss(42),covariates=list(bgim=bgim)) Note that you have to specify the interaction radius for the Strauss model (I have specified this radius to be 42 in the forgoing example); this radius is an ``irregular'' parameter --- i.e. it does not appear in exponential family form --- and hence is not estimated by ppm(), at least not directly. cheers, Rolf Turner ###################################################################### Attention:\ This e-mail message is privileged and confidenti...{{dropped}}