Loading ...
Sorry, an error occurred while loading the content.

AI-GEOSTATS: point pattern analysis/ R question

Expand Messages
  • Juliann Aukema
    Good afternoon. I realize this is slightly off-topic, but I thought it likely that someone on this list could help and we could take further discussion
    Message 1 of 4 , Aug 19, 2003
    • 0 Attachment
      Good afternoon. I realize this is slightly
      off-topic, but I thought it likely that someone on
      this list could help and we could take further
      discussion off-list.
      I have a mapped set of about 800 points in a
      Roughly rectangular plot and I would like to ask what
      is the distribution of these points (random, regular,
      aggregated, if aggregated- at what scale). I would
      then like to ask the same question about various
      subsets of points with respect to the underlying
      distribution of points. (For example, suppose all the
      points have an aggregated distribution, is a subset of
      points aggregated more/less than expected given the
      underlying aggregation). I thought Ripley�s K would be
      the way to go, but have been having trouble getting it
      to work. I�ve been trying to do it in R. I�ve made
      some graphics in R, but I�m really a novice and I find
      that the help (including the bit in the Venables and
      Ripley S-Plus book) is not quite sufficient to get me
      going with the spatial part (I�ve played with
      libraries Spatial, Spatstat, Splancs, GeoR).
      My questions are:
      ---Is Ripley�s K the way to go? Any suggestions on
      that? Would you recommend something else?
      ---Software (preferably inexpensive) recommendations?
      ---Would anyone be willing to share an R program that
      I could modify for my data and/or a sample or partial
      data set to make sure I have my data structured
      correctly for a particular library/procedure? (I found
      this was the best way to make progress in SAS, but I
      don�t know many R or S-Plus users).

      Thanks a lot.
      Juliann
      aukemaj@...


      __________________________________
      Do you Yahoo!?
      Yahoo! SiteBuilder - Free, easy-to-use web site design software
      http://sitebuilder.yahoo.com

      --
      * To post a message to the list, send it to ai-geostats@...
      * As a general service to the users, please remember to post a summary of any useful responses to your questions.
      * To unsubscribe, send an email to majordomo@... with no subject and "unsubscribe ai-geostats" followed by "end" on the next line in the message body. DO NOT SEND Subscribe/Unsubscribe requests to the list
      * Support to the list is provided at http://www.ai-geostats.org
    • Roger Bivand
      ... Using splancs in R, you should be able to use the getpoly() function interactively to produce subsets through bounding polygons, since the analysis
      Message 2 of 4 , Aug 19, 2003
      • 0 Attachment
        On Tue, 19 Aug 2003, Juliann Aukema wrote:

        > Good afternoon. I realize this is slightly
        > off-topic, but I thought it likely that someone on
        > this list could help and we could take further
        > discussion off-list.
        > I have a mapped set of about 800 points in a
        > Roughly rectangular plot and I would like to ask what
        > is the distribution of these points (random, regular,
        > aggregated, if aggregated- at what scale). I would
        > then like to ask the same question about various
        > subsets of points with respect to the underlying
        > distribution of points. (For example, suppose all the
        > points have an aggregated distribution, is a subset of
        > points aggregated more/less than expected given the
        > underlying aggregation). I thought Ripley’s K would be
        > the way to go, but have been having trouble getting it
        > to work. I’ve been trying to do it in R. I’ve made
        > some graphics in R, but I’m really a novice and I find
        > that the help (including the bit in the Venables and
        > Ripley S-Plus book) is not quite sufficient to get me
        > going with the spatial part (I’ve played with
        > libraries Spatial, Spatstat, Splancs, GeoR).
        > My questions are:
        > ---Is Ripley’s K the way to go? Any suggestions on
        > that? Would you recommend something else?
        > ---Software (preferably inexpensive) recommendations?
        > ---Would anyone be willing to share an R program that
        > I could modify for my data and/or a sample or partial
        > data set to make sure I have my data structured
        > correctly for a particular library/procedure? (I found
        > this was the best way to make progress in SAS, but I
        > don’t know many R or S-Plus users).

        Using splancs in R, you should be able to use the getpoly() function
        interactively to produce subsets through bounding polygons, since the
        analysis functions all need a polygon for edge correction. I think that
        you will find that looking at the examples in spatial or splancs
        carefully, splancs together with the relevant parts of Bailey, T.
        C. and Gatrell, A. C. (1995) Interactive spatial data analysis, would show
        how the data are structured - that is what the included data sets and
        code examples are there for:

        > library(splancs)
        > example(khat)

        runs the analysis from Bailey and Gatrell p. 94-5,

        > example(Kenv.csr)

        from p. 103-105, and

        > example(Kenv.pcp)

        testing against a Poisson cluster process from p. 108-9.

        This doesn't answer your scale-finding question, but I'm not sure that
        this is well-formed as it stands.

        Roger

        >
        > Thanks a lot.
        > Juliann
        > aukemaj@...
        >
        >
        > __________________________________
        > Do you Yahoo!?
        > Yahoo! SiteBuilder - Free, easy-to-use web site design software
        > http://sitebuilder.yahoo.com
        >
        > --
        > * To post a message to the list, send it to ai-geostats@...
        > * As a general service to the users, please remember to post a summary of any useful responses to your questions.
        > * To unsubscribe, send an email to majordomo@... with no subject and "unsubscribe ai-geostats" followed by "end" on the next line in the message body. DO NOT SEND Subscribe/Unsubscribe requests to the list
        > * Support to the list is provided at http://www.ai-geostats.org
        >

        --
        Roger Bivand
        Economic Geography Section, Department of Economics, Norwegian School of
        Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
        Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
        e-mail: Roger.Bivand@...


        --
        * To post a message to the list, send it to ai-geostats@...
        * As a general service to the users, please remember to post a summary of any useful responses to your questions.
        * To unsubscribe, send an email to majordomo@... with no subject and "unsubscribe ai-geostats" followed by "end" on the next line in the message body. DO NOT SEND Subscribe/Unsubscribe requests to the list
        * Support to the list is provided at http://www.ai-geostats.org
      • Juliann Aukema
        I sent this a week or so ago and am resending because I haven t seen it show up. Apologies if it did show up for some of you. Hi thanks for the responses,
        Message 3 of 4 , Aug 29, 2003
        • 0 Attachment
          I sent this a week or so ago and am resending because
          I haven't seen it show up. Apologies if it did show up
          for some of you.

          Hi thanks for the responses,

          Several people suggested using CrimeStat and one
          person sent an R script for Splancs (below). I've
          tried both of these with my data, trying to start as
          simply as possible, and I do get nice looking output
          when I put in the coordinates of all of my points
          (haven't made it to subsets yet). However, when I use
          CrimeStat with rectangular edge correction, my points
          appear to be dispersed -below the envelope for larger
          distances-(randomly distributed if I use no
          correction) and when I use the Splancs script, they
          appear to be aggregated -above the envelope for all
          distances. I used 100 simulation replicates for both
          methods. Any ideas why I would get such opposite
          results? Would it be the edge correction, differences
          in how L(d) is calculated, misinterpretation . . .? I
          must be missing something.

          Thanks a lot,


          Juliann

          > library(splancs)
          >
          > file<-"Filename.csv"
          >
          > point<-read.csv(file, header=TRUE, sep=";")
          >
          > box<-array(c(0,1000,1000,0,0,0,1000,1000),
          > dim=c(4,2))
          > s<-seq(0,500,5)
          > rep<-100
          >
          > pointk<-khat(as.points(point), box,s, newstyle=TRUE)
          > UL.khat<-Kenv.csr(length(point$x), box,rep, s)
          >
          > plot(s, sqrt(pointk$khat/pi)-s, type="l",
          >
          ylim=c(min(c(min(sqrt(pointk$khat/pi)-s),min(sqrt(UL.khat$lower/pi)-s)))-0.5
          >
          >
          ,max(c(max(sqrt(pointk$khat/pi)-s),max(sqrt(UL.khat$upper/pi)-s)))+0.5),
          >
          > main=paste(sub(".csv","",file),"_RK", sep=""),
          > xlab="Distance d (m)",
          > ylab="L(d)-d")
          > lines(s, sqrt(UL.khat$upper/pi)-s, lty=2)
          > lines(s, sqrt(UL.khat$lower/pi)-s, lty=2)
          > lines(s, s*0, lty=1)
          >
          > df<-data.frame(d=s, data=sqrt(pointk$khat/pi)-s,
          > upper=sqrt(UL.khat$upper/pi)-s,
          > lower=sqrt(UL.khat$lower/pi)-s)
          >
          > write.table(df,
          > paste(sub(".csv","",file),"_RK",rep,".csv", sep=""),
          >
          > sep=";", row.names=TRUE)
          >
          > write.table(sqrt(pointk$khats/pi),
          > paste(sub(".csv","",file),"_RKMap.csv",
          > sep=""), sep=";", row.names=TRUE)
          >
          > dev.copy2eps()
          >
          > shell(paste("move rplot.eps
          > ",sub(".csv","",file),"_RK",rep,".eps", sep=""))


          ----------Original Post---------------------------
          > At 14:05 19.08.2003 -0700, you wrote:
          > > Good afternoon. I realize this is slightly
          > >off-topic, but I thought it likely that someone on
          > >this list could help and we could take further
          > >discussion off-list.
          > > I have a mapped set of about 800 points in a
          > >Roughly rectangular plot and I would like to ask
          > what
          > >is the distribution of these points (random,
          > regular,
          > >aggregated, if aggregated- at what scale). I would
          > >then like to ask the same question about various
          > >subsets of points with respect to the underlying
          > >distribution of points. (For example, suppose all
          > the
          > >points have an aggregated distribution, is a subset
          > of
          > >points aggregated more/less than expected given the
          > >underlying aggregation). I thought Ripley's K would
          > be
          > >the way to go, but have been having trouble getting
          > it
          > >to work. I've been trying to do it in R. I've made
          > >some graphics in R, but I'm really a novice and I
          > find
          > >that the help (including the bit in the Venables
          > and
          > >Ripley S-Plus book) is not quite sufficient to get
          > me
          > >going with the spatial part (I've played with
          > >libraries Spatial, Spatstat, Splancs, GeoR).
          > > My questions are:
          > >---Is Ripley's K the way to go? Any suggestions on
          > >that? Would you recommend something else?
          > >---Software (preferably inexpensive)
          > recommendations?
          > >---Would anyone be willing to share an R program
          > that
          > >I could modify for my data and/or a sample or
          > partial
          > >data set to make sure I have my data structured
          > >correctly for a particular library/procedure? (I
          > found
          > >this was the best way to make progress in SAS, but
          > I
          > >don't know many R or S-Plus users).
          > >
          > >Thanks a lot.
          > >Juliann
          > >aukemaj@...
          > >
          > >
          > >__________________________________
          > >Do you Yahoo!?
          > >Yahoo! SiteBuilder - Free, easy-to-use web site
          > design software
          > >http://sitebuilder.yahoo.com
          > >
          > >--
          > >* To post a message to the list, send it to
          > ai-geostats@...
          > >* As a general service to the users, please
          > remember to post a summary of
          > >any useful responses to your questions.
          >
          === message truncated ===






          __________________________________
          Do you Yahoo!?
          Yahoo! SiteBuilder - Free, easy-to-use web site design software
          http://sitebuilder.yahoo.com

          --
          * To post a message to the list, send it to ai-geostats@...
          * As a general service to the users, please remember to post a summary of any useful responses to your questions.
          * To unsubscribe, send an email to majordomo@... with no subject and "unsubscribe ai-geostats" followed by "end" on the next line in the message body. DO NOT SEND Subscribe/Unsubscribe requests to the list
          * Support to the list is provided at http://www.ai-geostats.org
        • Carolyn & Richard Block
          Juliann I am not certain that Ned Levine, the developer of CrimeStat, has read this. I will forward it to him. Normal edge corrections don t work very well
          Message 4 of 4 , Sep 1, 2003
          • 0 Attachment
            Juliann
            I am not certain that Ned Levine, the developer of CrimeStat, has read this.
            I will forward it to him. Normal edge corrections don't work very well
            in looking at point patterns of crime because incidents of crime tend to
            cluster at city boundaries and jurisdictional changes. The program may be
            less tested for edge corrections than other things; however, CrimeStat 3 is
            now under development. Notification of any corrections and problems would
            be welcome.
            Dick
            ----- Original Message -----
            From: "Juliann Aukema" <aukemaj@...>
            To: <ai-geostats@...>; "fs" <jaukema@...>
            Sent: Friday, August 29, 2003 3:37 PM
            Subject: Follow-up Q Crimestat/Splancs AI-GEOSTATS: point pattern analysis/
            R question


            > I sent this a week or so ago and am resending because
            > I haven't seen it show up. Apologies if it did show up
            > for some of you.
            >
            > Hi thanks for the responses,
            >
            > Several people suggested using CrimeStat and one
            > person sent an R script for Splancs (below). I've
            > tried both of these with my data, trying to start as
            > simply as possible, and I do get nice looking output
            > when I put in the coordinates of all of my points
            > (haven't made it to subsets yet). However, when I use
            > CrimeStat with rectangular edge correction, my points
            > appear to be dispersed -below the envelope for larger
            > distances-(randomly distributed if I use no
            > correction) and when I use the Splancs script, they
            > appear to be aggregated -above the envelope for all
            > distances. I used 100 simulation replicates for both
            > methods. Any ideas why I would get such opposite
            > results? Would it be the edge correction, differences
            > in how L(d) is calculated, misinterpretation . . .? I
            > must be missing something.
            >
            > Thanks a lot,
            >
            >
            > Juliann
            >
            > > library(splancs)
            > >
            > > file<-"Filename.csv"
            > >
            > > point<-read.csv(file, header=TRUE, sep=";")
            > >
            > > box<-array(c(0,1000,1000,0,0,0,1000,1000),
            > > dim=c(4,2))
            > > s<-seq(0,500,5)
            > > rep<-100
            > >
            > > pointk<-khat(as.points(point), box,s, newstyle=TRUE)
            > > UL.khat<-Kenv.csr(length(point$x), box,rep, s)
            > >
            > > plot(s, sqrt(pointk$khat/pi)-s, type="l",
            > >
            >
            ylim=c(min(c(min(sqrt(pointk$khat/pi)-s),min(sqrt(UL.khat$lower/pi)-s)))-0.5
            > >
            > >
            > ,max(c(max(sqrt(pointk$khat/pi)-s),max(sqrt(UL.khat$upper/pi)-s)))+0.5),
            > >
            > > main=paste(sub(".csv","",file),"_RK", sep=""),
            > > xlab="Distance d (m)",
            > > ylab="L(d)-d")
            > > lines(s, sqrt(UL.khat$upper/pi)-s, lty=2)
            > > lines(s, sqrt(UL.khat$lower/pi)-s, lty=2)
            > > lines(s, s*0, lty=1)
            > >
            > > df<-data.frame(d=s, data=sqrt(pointk$khat/pi)-s,
            > > upper=sqrt(UL.khat$upper/pi)-s,
            > > lower=sqrt(UL.khat$lower/pi)-s)
            > >
            > > write.table(df,
            > > paste(sub(".csv","",file),"_RK",rep,".csv", sep=""),
            > >
            > > sep=";", row.names=TRUE)
            > >
            > > write.table(sqrt(pointk$khats/pi),
            > > paste(sub(".csv","",file),"_RKMap.csv",
            > > sep=""), sep=";", row.names=TRUE)
            > >
            > > dev.copy2eps()
            > >
            > > shell(paste("move rplot.eps
            > > ",sub(".csv","",file),"_RK",rep,".eps", sep=""))
            >
            >
            > ----------Original Post---------------------------
            > > At 14:05 19.08.2003 -0700, you wrote:
            > > > Good afternoon. I realize this is slightly
            > > >off-topic, but I thought it likely that someone on
            > > >this list could help and we could take further
            > > >discussion off-list.
            > > > I have a mapped set of about 800 points in a
            > > >Roughly rectangular plot and I would like to ask
            > > what
            > > >is the distribution of these points (random,
            > > regular,
            > > >aggregated, if aggregated- at what scale). I would
            > > >then like to ask the same question about various
            > > >subsets of points with respect to the underlying
            > > >distribution of points. (For example, suppose all
            > > the
            > > >points have an aggregated distribution, is a subset
            > > of
            > > >points aggregated more/less than expected given the
            > > >underlying aggregation). I thought Ripley's K would
            > > be
            > > >the way to go, but have been having trouble getting
            > > it
            > > >to work. I've been trying to do it in R. I've made
            > > >some graphics in R, but I'm really a novice and I
            > > find
            > > >that the help (including the bit in the Venables
            > > and
            > > >Ripley S-Plus book) is not quite sufficient to get
            > > me
            > > >going with the spatial part (I've played with
            > > >libraries Spatial, Spatstat, Splancs, GeoR).
            > > > My questions are:
            > > >---Is Ripley's K the way to go? Any suggestions on
            > > >that? Would you recommend something else?
            > > >---Software (preferably inexpensive)
            > > recommendations?
            > > >---Would anyone be willing to share an R program
            > > that
            > > >I could modify for my data and/or a sample or
            > > partial
            > > >data set to make sure I have my data structured
            > > >correctly for a particular library/procedure? (I
            > > found
            > > >this was the best way to make progress in SAS, but
            > > I
            > > >don't know many R or S-Plus users).
            > > >
            > > >Thanks a lot.
            > > >Juliann
            > > >aukemaj@...
            > > >
            > > >
            > > >__________________________________
            > > >Do you Yahoo!?
            > > >Yahoo! SiteBuilder - Free, easy-to-use web site
            > > design software
            > > >http://sitebuilder.yahoo.com
            > > >
            > > >--
            > > >* To post a message to the list, send it to
            > > ai-geostats@...
            > > >* As a general service to the users, please
            > > remember to post a summary of
            > > >any useful responses to your questions.
            > >
            > === message truncated ===
            >
            >
            >
            >
            >
            >
            > __________________________________
            > Do you Yahoo!?
            > Yahoo! SiteBuilder - Free, easy-to-use web site design software
            > http://sitebuilder.yahoo.com
            >
            > --
            > * To post a message to the list, send it to ai-geostats@...
            > * As a general service to the users, please remember to post a summary of
            any useful responses to your questions.
            > * To unsubscribe, send an email to majordomo@... with no subject and
            "unsubscribe ai-geostats" followed by "end" on the next line in the message
            body. DO NOT SEND Subscribe/Unsubscribe requests to the list
            > * Support to the list is provided at http://www.ai-geostats.org



            --
            * To post a message to the list, send it to ai-geostats@...
            * As a general service to the users, please remember to post a summary of any useful responses to your questions.
            * To unsubscribe, send an email to majordomo@... with no subject and "unsubscribe ai-geostats" followed by "end" on the next line in the message body. DO NOT SEND Subscribe/Unsubscribe requests to the list
            * Support to the list is provided at http://www.ai-geostats.org
          Your message has been successfully submitted and would be delivered to recipients shortly.