[R-sig-Geo] Problem re-projecting Spatstat ppm model from lonlat to utm
Ben Madin
lists at remoteinformation.com.au
Wed Jul 20 08:51:43 CEST 2011
G'day all,
I have been using the ppm() function to try (mainly successfully) to fit an outbreak pattern from the spatstat library (1-22)
This was giving me results that were consistent with my observations, showing a trend related to a village density and increasing towards the east of the region. However, the scalebar was somewhat out of range, and I've realised I was working in longitude/latitude for my coordinates.
I've transformed all of the data to utm, and gone through the same process, but when I try to fit the same model, I'm getting the following messages:
fit2.utm <- ppm(outbreaks.utm.ppp, ~ x + y + dens, covariates=list(dens=vill.dens.utm), use.gam=TRUE)
Warning messages:
1: In countingweights(id, areas) :
Some tiles with zero area contain points
2: In countingweights(id, areas) : Some weights are zero
The two (one) data sets are given below :
> summary(outbreaks.ll.ppp)
Marked planar point pattern: 2231 points
Average intensity 12.9 points per square unit
Multitype:
frequency proportion intensity
A 222 0.09950 1.2800
Asia1 7 0.00314 0.0403
O 1090 0.48900 6.2800
Unknown 912 0.40900 5.2600
Window: polygonal boundary
single connected closed polygon with 2222 vertices
enclosing rectangle: [92.20499, 109.46484]x[1.269528, 28.546524]units
Window area = 173.539 square units
*** 36 illegal points stored in attr(,„rejects‰) ***
> summary(outbreaks.utm.ppp)
Marked planar point pattern: 2102 points
Average intensity 1.01e-09 points per square unit
Multitype:
frequency proportion intensity
A 215 0.10200 1.03e-10
Asia1 6 0.00285 2.88e-12
O 1000 0.47600 4.80e-10
Unknown 880 0.41900 4.22e-10
Window: polygonal boundary
single connected closed polygon with 2222 vertices
enclosing rectangle: [417539.8, 2308845.2]x[142732, 3166241]units
Window area = 2.08442e+12 square units
*** 165 illegal points stored in attr(,„rejects‰) ***
The result of the two models are given below :
> fit2.ll
Nonstationary multitype Poisson process
Possible marks:
A Asia1 O Unknown
Trend formula: ~x + y + dens
Fitted coefficients for trend formula:
(Intercept) x y dens
0.3513215637 0.0141986623 -0.0176586862 0.0004128483
Estimate S.E. Ztest CI95.lo CI95.hi
(Intercept) 0.3513215637 4.494623e-01 -0.5296082814 1.2322514088
x 0.0141986623 4.211134e-03 *** 0.0059449912 0.0224523335
y -0.0176586862 2.966964e-03 *** -0.0234738292 -0.0118435432
dens 0.0004128483 4.701333e-05 *** 0.0003207039 0.0005049927
Warning message:
model was fitted by gam(); asymptotic variance calculation ignores this
> fit2.utm
Nonstationary multitype Poisson process
Possible marks:
A Asia1 O Unknown
Trend formula: ~x + y + dens
Fitted coefficients for trend formula:
(Intercept) x y dens
-2.193521e+01 1.991195e-07 -1.734678e-07 5.609414e+00
Warning message:
model was fitted by gam(); asymptotic variance calculation ignores this
and any attempt to plot fit2.utm fails - I suspect this is to do with 'empty' cells or the cell intensity? Is there some way around this?
cheers
Ben
sessionInfo()
R version 2.13.0 Patched (2011-05-26 r55996)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
locale:
[1] en_AU.UTF-8/en_AU.UTF-8/C/C/en_AU.UTF-8/en_AU.UTF-8
attached base packages:
[1] grid stats graphics grDevices utils datasets methods
[8] base
other attached packages:
[1] spatstat_1.22-3 RandomFields_2.0.45 deldir_0.0-14
[4] mgcv_1.7-6 rgdal_0.6-33 Cairo_1.4-9
[7] surveillance_1.2-1 Matrix_0.999375-50 msm_1.0.1
[10] vcd_1.2-11 colorspace_1.1-0 MASS_7.3-13
[13] maptools_0.8-9 lattice_0.19-30 foreign_0.8-44
[16] spc_0.4.0 xtable_1.5-6 rgeos_0.1-4
[19] stringr_0.5 sp_0.9-83 zoo_1.6-5
[22] RColorBrewer_1.0-5 RPostgreSQL_0.1-7 DBI_0.2-5
loaded via a namespace (and not attached):
[1] mvtnorm_0.9-9991 nlme_3.1-101 plyr_1.5.2 splines_2.13.0
[5] survival_2.36-9 tools_2.13.0
More information about the R-sig-Geo
mailing list