Adrian,
Thanks very much for your help (and for your package in general!).
I did what was suggested below, and can indeed estimate the model, but it
takes quite a while to run (much longer than when I was running it year by
year). Is there a way to speed up the calculations (at least for a
preliminary analysis).  I tried looking through the quadrature documentation
of the package and compiling R against the MKL library to use the
multithreading in that library (in case that was relevant to spatstat), but
I have not had much success in making things faster. I welcome any
suggestions.
Thanks!

On Fri, Apr 30, 2010 at 12:00 AM, <adrian.badde...@csiro.au> wrote:

> Ted Rosenbaum <ted.rosenb...@yale.edu> wrote:
>
> > I am looking to estimate a model using a MLE model of an inhomogenous
> > Poisson point process (using ppm) in spatstat.  I have data on points
> that
> > span many years (panel data) and I am looking to estimate a model where
> > I can have the same coefficients for covariates for all years, but have
> > different values of the covariates (points in space) for each year
> > (basically run a traditional panel data regression, but for a point
> > process), and allow for differing mean intensity by year (ie a year
> "fixed
> > effect").  Is there a way to do this in spatstat (or another simple way
> to
> > do it, without needing to code up the MLE and accompanying integral by
> > myself).
>
> In a forthcoming version of spatstat it will be possible to do this
> seamlessly. (The code already exists but is not yet released.)
>
> For now, the simplest way to do this is to attach a mark to each point
> representing the year. Make sure that the mark is a factor. Then for each
> covariate, construct a function with arguments (x,y,year) that extracts the
> value of the covariate at location (x,y) in the given year. These functions
> should be in the global environment. Then fit a model using these covariate
> functions.
>
> Example:
>          # make some point data
>          X2001 <- runifpoint(42)
>          X2002 <- runifpoint(30)
>          # make some covariate images
>          pH2001 <- density(runifpoint(17))
>          pH2002 <- density(runifpoint(20))
>          # tweak
>          X <- superimpose("2001"=X2001, "2002"=X2002)
>          pH <- function(x,y,year) {
>                 ifelse(year == "2001", pH2001[cbind(x,y)],
> pH2002[cbind(x,y)] )
>          }
>          # go
>          ppm(X, ~marks + pH(x,y,marks))
>
> In the model formula, the first term 'marks' gives you the fixed effect for
> each year. A typical result is:
>
> ..................................
> Nonstationary multitype Poisson process
> Possible marks:
> 2001 2002
>
> Trend formula: ~marks + pH(x, y, marks)
>
> Fitted coefficients for trend formula:
>    (Intercept)       marks2002 pH(x, y, marks)
>    3.852512251    -0.308405720    -0.006997323
>
> ..................................
>
> So the fixed effect estimates are 3.85 for 2001, and 3.85-0.31 = 3.54 for
> 2002, while the (year-independent) coefficient of the pH covariate is
> -0.007.
>
> You can also do things like
>
>         ppm(X, ~marks + polynom(pH(x,y,marks), 3))
>
> to get a cubic function of the pH covariate.
>
> Adrian Baddeley
>
> --------------------------------
>
> Prof Adrian Baddeley (UWA/CSIRO)
> CSIRO Mathematics, Informatics & Statistics
> Leeuwin Centre, 65 Brockway Road, Floreat WA 6014, Australia
> Tel: 08 9333 6177 | Fax: 08 9333 6121 | Mob: 0410 447 821
>

        [[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

Reply via email to