[R-sig-Geo] output data from R to SaTScan
James Rooney
ROONEYJ4 at tcd.ie
Mon Aug 26 23:23:26 CEST 2013
Hi Hugh,
Thanks for your answer. Yes I've seen it said that those packages can do most of what SaTScan does.
I'm playing with Kulldorff's Statistic as implemented in section 11.5.6 of ASDAR - but a few things confuse me:
1. How do I decide what the correct value for fractpop is ? I initially had it set to .25 and I was getting cluster of 50% of my cases which made no sense.
2. Is there any correction for multiple testing in the opgam() command ? I have over 3000 areas - do I need to set a very low alpha ?
3. How do I detect more than one cluster ? I have maps where I suspect 2 or 3 separate clusters based on smoothed RR's.
My code currently looks like this (which I based on the code for Fig11.18 in the book and this useful question and answer: http://r-sig-geo.2731867.n2.nabble.com/Strange-results-in-DCluster-package-td7326832.html )
sa<-data.frame(Observed=ED$var1)
sa<-cbind(sa, Expected=mean(ED$var1))
sa<-cbind(sa, x=ED$x, y=ED$y)
sa$Observed<-as.numeric(sa$Observed)
#Kuldorff-Nagarwalla analysis
mle<-calculate.mle(sa, model="poisson")
knres<-opgam(data=sa, thegrid=sa[,c("x", "y")], alpha=.025, R=99,
iscluster=kn.iscluster, fractpop=.10, model="poisson", mle=mle, log.v=TRUE)
#Print cluster result
clusters<-get.knclusters(as(ED, "data.frame"), knres)
i<-which.max(knres$statistic)
ED$KNcluster<-""
ED$KNcluster[clusters[[i]]]<-"cluster"
ED$KNcluster[clusters[[i]][1]]<-"centre"
ED$KNcluster<-as.factor(ED$KNcluster)
print(spplot(ED, "KNcluster", main="Kulldorff's method",
col.regions=c(gray(1), gray(.5), gray(.8))))
Thanks,
James
________________________________________
From: Hugh Sturrock [hughsturrock at hotmail.com]
Sent: 26 August 2013 17:10
To: James Rooney; r-sig-geo at r-project.org
Subject: RE: [R-sig-Geo] output data from R to SaTScan
Hi James,
Not sure how to do that, but check out SpatialEpi and Dcluster packages, I believe they can do a lot of what SaTScan does..
Cheers, Hugh
> From: ROONEYJ4 at tcd.ie
> To: r-sig-geo at r-project.org
> Date: Mon, 26 Aug 2013 16:42:55 +0100
> Subject: [R-sig-Geo] output data from R to SaTScan
>
> Hi all,
>
> So I have created some maps in R, smoothed then using the BYM model in Openbugs and opened the CODA files in R once again to analyze results etc.
>
> I would like to now test for clusters using SaTScan and the post smoothing data - but I can find very little info anywhere on how to output my R data into a format that SaTScan can use. My data within R is in the form of a SpatialPolygonsDataFrame which up until now I have been saving as an ESRI shapefile with the command:
> writeOGR(data, "", layer="data_out",driver="ESRI Shapefile",overwrite=T)
>
> But from what info I can find, I think this doesn't seem to be a useful format for SaTScan.
>
> Any advice would be appreciated on how to achieve this!
> Many thanks,
> James
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
More information about the R-sig-Geo
mailing list