DCluster is very nice tool, especially Stan Openshaw's GAM.
Thank you!
DCluster's GAM's testing function is different from original GAM whose
testing function used Monte Carlo method.
Could you tell me how I can execute original GAM using DCluster?
Well, I think you can write your own function to do that and pass it to
opgam as argument 'iscluster'. The default value is
'opgam.iscluster.default':
opgam.iscluster.default<-function (data, idx, idxorder, alpha, ...)
{
localO <- sum(data$Observed[idx])
localE <- sum(data$Expected[idx])
if (localE == 0)
return(c(localO, NA, NA))
localP <- sum(data$Population[idx])
pvalue <- ppois(localO, localE, lower.tail = FALSE)
return(c(localO, alpha > pvalue, pvalue))
}
What you can do is to change the line where the pvalue is calculated
and, instead of using 'ppois' use a function that performs a Monte Carlo
test. Probably you will not need localR nor localP if you use Monte
Carlo.
So, the function could be simething like:
montecarlo.iscluster<-function(data, idx, idxorder, alpha, ...)
{
localO <- sum(data$Observed[idx])
pvalue <- return_pvalue_from_monte_carlo_simulations(data, localO)
return(c(localO, alpha > pvalue, pvalue))
}
where 'return_pvalue_from_monte_carlo_simulations' performs the M.C.
simulations and compare localO with the values obtained to compute
the pvalue.
I hope it's clear... if not, just tell me. :D
And can I execute GAM/K using DCluster?
Not at the moment, but 'opgam' returns the coordinates of the centres of
the balls that were significant, so I guess that you can use other R
packages to calculate a density from this table.
I have also written some code (not released yet) to calculate how many
times a centroid is included in these circles, in case you are
interested. I know it's not GAM/K but it can be useful for some
purposes...
Best regards,
Virgilio G?mez Rubio
Grup d'Estad?stica espacial i temporal
en Epidemiologia i medi ambient
Dpto. Estad?stica e I. O. - Facultat de Matem?tiques
Avda. Vicent A. Estell?s, 1 - 46100 Burjassot
Valencia - SPAIN
http://matheron.uv.es/~virgil
TLF: 00 34 96 354 43 62 - FAX: 00 34 96 354 47 35