Find maximum theoretical join count (spatial statistics) Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Using ArcGIS spatial statistics tools on average values?Spatial statistics software for GIS?Learning Spatial Statistics?Interpolating Maps - Statistical Learning Techniques vs Spatial Statistics TechniquesSpatial Join to count points in polygons in lat/lon in PostGIS?Spatial Statistics in mapinfo 15 64 bitSpatial statistics using ArcGISSummary Statistics after Spatial Joining in ModelbuilderGeoPandas spatial join and count

Is "Reachable Object" really an NP-complete problem?

2001: A Space Odyssey's use of the song "Daisy Bell" (Bicycle Built for Two); life imitates art or vice-versa?

Chinese Seal on silk painting - what does it mean?

If a VARCHAR(MAX) column is included in an index, is the entire value always stored in the index page(s)?

An adverb for when you're not exaggerating

How does the math work when buying airline miles?

How to Make a Beautiful Stacked 3D Plot

If a contract sometimes uses the wrong name, is it still valid?

Fantasy story; one type of magic grows in power with use, but the more powerful they are, they more they are drawn to travel to their source

Is there a kind of relay only consumes power when switching?

How to convince students of the implication truth values?

Is CEO the profession with the most psychopaths?

When a candle burns, why does the top of wick glow if bottom of flame is hottest?

Closed form of recurrent arithmetic series summation

What font is "z" in "z-score"?

How to compare two different files line by line in unix?

Why are the trig functions versine, haversine, exsecant, etc, rarely used in modern mathematics?

Where are Serre’s lectures at Collège de France to be found?

How to find all the available tools in mac terminal?

Withdrew £2800, but only £2000 shows as withdrawn on online banking; what are my obligations?

Do I really need recursive chmod to restrict access to a folder?

How can I use the Python library networkx from Mathematica?

What is the longest distance a player character can jump in one leap?

Extracting terms with certain heads in a function



Find maximum theoretical join count (spatial statistics)



Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?Using ArcGIS spatial statistics tools on average values?Spatial statistics software for GIS?Learning Spatial Statistics?Interpolating Maps - Statistical Learning Techniques vs Spatial Statistics TechniquesSpatial Join to count points in polygons in lat/lon in PostGIS?Spatial Statistics in mapinfo 15 64 bitSpatial statistics using ArcGISSummary Statistics after Spatial Joining in ModelbuilderGeoPandas spatial join and count



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















In addition to calculating the joint count statistic, I would like to compare the actual count of joins to the theoretical maximum count of joins. I know how to compute the statistic and find the actual count of joins for a given group (under conditions of two group), but how can I find the theoretical maximum given the known count of members in each group? I would preferably solve this using Python or PostGIS. I am currently using the Pysal module to calculate the joint count statistics. The input data are census tract polygon shapefiles with arbitrary boundaries, making it impossible to simply agglomerate from east to west or north to south, etc.



EDIT: I am asking about the maximum possible count of within-group joins.










share|improve this question






























    0















    In addition to calculating the joint count statistic, I would like to compare the actual count of joins to the theoretical maximum count of joins. I know how to compute the statistic and find the actual count of joins for a given group (under conditions of two group), but how can I find the theoretical maximum given the known count of members in each group? I would preferably solve this using Python or PostGIS. I am currently using the Pysal module to calculate the joint count statistics. The input data are census tract polygon shapefiles with arbitrary boundaries, making it impossible to simply agglomerate from east to west or north to south, etc.



    EDIT: I am asking about the maximum possible count of within-group joins.










    share|improve this question


























      0












      0








      0








      In addition to calculating the joint count statistic, I would like to compare the actual count of joins to the theoretical maximum count of joins. I know how to compute the statistic and find the actual count of joins for a given group (under conditions of two group), but how can I find the theoretical maximum given the known count of members in each group? I would preferably solve this using Python or PostGIS. I am currently using the Pysal module to calculate the joint count statistics. The input data are census tract polygon shapefiles with arbitrary boundaries, making it impossible to simply agglomerate from east to west or north to south, etc.



      EDIT: I am asking about the maximum possible count of within-group joins.










      share|improve this question
















      In addition to calculating the joint count statistic, I would like to compare the actual count of joins to the theoretical maximum count of joins. I know how to compute the statistic and find the actual count of joins for a given group (under conditions of two group), but how can I find the theoretical maximum given the known count of members in each group? I would preferably solve this using Python or PostGIS. I am currently using the Pysal module to calculate the joint count statistics. The input data are census tract polygon shapefiles with arbitrary boundaries, making it impossible to simply agglomerate from east to west or north to south, etc.



      EDIT: I am asking about the maximum possible count of within-group joins.







      python postgis spatial-statistics pysal






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Sep 12 '17 at 19:13







      eric s

















      asked Sep 12 '17 at 17:42









      eric seric s

      1258




      1258




















          1 Answer
          1






          active

          oldest

          votes


















          0














          the theoretical maximum of a join is given by the Cartesian product of the sets. That's literally what CROSS JOIN does it gives you the maximum-join which you reduce later.



          SELECT *
          FROM generate_series(1,3) AS gs1(x)
          CROSS JOIN generate_series(17,23) AS gs2(y);
          x | y
          ---+----
          1 | 17
          1 | 18
          1 | 19
          1 | 20
          1 | 21
          1 | 22
          1 | 23
          2 | 17
          2 | 18
          2 | 19
          2 | 20
          2 | 21
          2 | 22
          2 | 23
          3 | 17
          3 | 18
          3 | 19
          3 | 20
          3 | 21
          3 | 22
          3 | 23
          (21 rows)





          share|improve this answer























          • Thank you. I am asking about joins based on spatial relationships. Each item can only be joined to spatial neighbors, not to each element in the set. Elements with value '1' in col 'x' in your example would be restricted to joining elements based on spatial adjacency. Perhaps I misunderstand the application of your example to solving this problem.

            – eric s
            Sep 12 '17 at 18:31







          • 1





            So you reduce the set by WHERE ST_Touches(x,y) or the like. The theoretical maximum is every element touches every other element. If the real world/spacetime or whatever prohibits that you just have to reduce from that set. The cross join is the theoretical maximum. The second things have real world constraints you're outside of that.

            – Evan Carroll
            Sep 12 '17 at 18:34












          • I don't think this will get the result I am after. The theoretical maximum is indeed limited by real-world spatial relationships. If I have a county with n ZIP codes and k of them are in group j, I want to know what the maximum possible number of joins possible would if k number of ZIP codes were reassigned to group j so as to maximize the join count. This likely requires an iterative solving algorithm, not a simple table query.

            – eric s
            Sep 13 '17 at 19:45











          • What do you think the word "theoretical" means vs "real world." I have no idea how you're assigning your variables there k is being used in two contexts.

            – Evan Carroll
            Sep 13 '17 at 21:31











          • "Hypothetical maximum" would perhaps be more accurate. I used "theoretical" to contrast with "actual." I asked in the context of applying a particular spatial statistic where I thought the meaning of "theoretical maximum" would be reasonably clear.

            – eric s
            Sep 13 '17 at 22:00












          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "79"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f255131%2ffind-maximum-theoretical-join-count-spatial-statistics%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          the theoretical maximum of a join is given by the Cartesian product of the sets. That's literally what CROSS JOIN does it gives you the maximum-join which you reduce later.



          SELECT *
          FROM generate_series(1,3) AS gs1(x)
          CROSS JOIN generate_series(17,23) AS gs2(y);
          x | y
          ---+----
          1 | 17
          1 | 18
          1 | 19
          1 | 20
          1 | 21
          1 | 22
          1 | 23
          2 | 17
          2 | 18
          2 | 19
          2 | 20
          2 | 21
          2 | 22
          2 | 23
          3 | 17
          3 | 18
          3 | 19
          3 | 20
          3 | 21
          3 | 22
          3 | 23
          (21 rows)





          share|improve this answer























          • Thank you. I am asking about joins based on spatial relationships. Each item can only be joined to spatial neighbors, not to each element in the set. Elements with value '1' in col 'x' in your example would be restricted to joining elements based on spatial adjacency. Perhaps I misunderstand the application of your example to solving this problem.

            – eric s
            Sep 12 '17 at 18:31







          • 1





            So you reduce the set by WHERE ST_Touches(x,y) or the like. The theoretical maximum is every element touches every other element. If the real world/spacetime or whatever prohibits that you just have to reduce from that set. The cross join is the theoretical maximum. The second things have real world constraints you're outside of that.

            – Evan Carroll
            Sep 12 '17 at 18:34












          • I don't think this will get the result I am after. The theoretical maximum is indeed limited by real-world spatial relationships. If I have a county with n ZIP codes and k of them are in group j, I want to know what the maximum possible number of joins possible would if k number of ZIP codes were reassigned to group j so as to maximize the join count. This likely requires an iterative solving algorithm, not a simple table query.

            – eric s
            Sep 13 '17 at 19:45











          • What do you think the word "theoretical" means vs "real world." I have no idea how you're assigning your variables there k is being used in two contexts.

            – Evan Carroll
            Sep 13 '17 at 21:31











          • "Hypothetical maximum" would perhaps be more accurate. I used "theoretical" to contrast with "actual." I asked in the context of applying a particular spatial statistic where I thought the meaning of "theoretical maximum" would be reasonably clear.

            – eric s
            Sep 13 '17 at 22:00
















          0














          the theoretical maximum of a join is given by the Cartesian product of the sets. That's literally what CROSS JOIN does it gives you the maximum-join which you reduce later.



          SELECT *
          FROM generate_series(1,3) AS gs1(x)
          CROSS JOIN generate_series(17,23) AS gs2(y);
          x | y
          ---+----
          1 | 17
          1 | 18
          1 | 19
          1 | 20
          1 | 21
          1 | 22
          1 | 23
          2 | 17
          2 | 18
          2 | 19
          2 | 20
          2 | 21
          2 | 22
          2 | 23
          3 | 17
          3 | 18
          3 | 19
          3 | 20
          3 | 21
          3 | 22
          3 | 23
          (21 rows)





          share|improve this answer























          • Thank you. I am asking about joins based on spatial relationships. Each item can only be joined to spatial neighbors, not to each element in the set. Elements with value '1' in col 'x' in your example would be restricted to joining elements based on spatial adjacency. Perhaps I misunderstand the application of your example to solving this problem.

            – eric s
            Sep 12 '17 at 18:31







          • 1





            So you reduce the set by WHERE ST_Touches(x,y) or the like. The theoretical maximum is every element touches every other element. If the real world/spacetime or whatever prohibits that you just have to reduce from that set. The cross join is the theoretical maximum. The second things have real world constraints you're outside of that.

            – Evan Carroll
            Sep 12 '17 at 18:34












          • I don't think this will get the result I am after. The theoretical maximum is indeed limited by real-world spatial relationships. If I have a county with n ZIP codes and k of them are in group j, I want to know what the maximum possible number of joins possible would if k number of ZIP codes were reassigned to group j so as to maximize the join count. This likely requires an iterative solving algorithm, not a simple table query.

            – eric s
            Sep 13 '17 at 19:45











          • What do you think the word "theoretical" means vs "real world." I have no idea how you're assigning your variables there k is being used in two contexts.

            – Evan Carroll
            Sep 13 '17 at 21:31











          • "Hypothetical maximum" would perhaps be more accurate. I used "theoretical" to contrast with "actual." I asked in the context of applying a particular spatial statistic where I thought the meaning of "theoretical maximum" would be reasonably clear.

            – eric s
            Sep 13 '17 at 22:00














          0












          0








          0







          the theoretical maximum of a join is given by the Cartesian product of the sets. That's literally what CROSS JOIN does it gives you the maximum-join which you reduce later.



          SELECT *
          FROM generate_series(1,3) AS gs1(x)
          CROSS JOIN generate_series(17,23) AS gs2(y);
          x | y
          ---+----
          1 | 17
          1 | 18
          1 | 19
          1 | 20
          1 | 21
          1 | 22
          1 | 23
          2 | 17
          2 | 18
          2 | 19
          2 | 20
          2 | 21
          2 | 22
          2 | 23
          3 | 17
          3 | 18
          3 | 19
          3 | 20
          3 | 21
          3 | 22
          3 | 23
          (21 rows)





          share|improve this answer













          the theoretical maximum of a join is given by the Cartesian product of the sets. That's literally what CROSS JOIN does it gives you the maximum-join which you reduce later.



          SELECT *
          FROM generate_series(1,3) AS gs1(x)
          CROSS JOIN generate_series(17,23) AS gs2(y);
          x | y
          ---+----
          1 | 17
          1 | 18
          1 | 19
          1 | 20
          1 | 21
          1 | 22
          1 | 23
          2 | 17
          2 | 18
          2 | 19
          2 | 20
          2 | 21
          2 | 22
          2 | 23
          3 | 17
          3 | 18
          3 | 19
          3 | 20
          3 | 21
          3 | 22
          3 | 23
          (21 rows)






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Sep 12 '17 at 18:22









          Evan CarrollEvan Carroll

          4,9821341




          4,9821341












          • Thank you. I am asking about joins based on spatial relationships. Each item can only be joined to spatial neighbors, not to each element in the set. Elements with value '1' in col 'x' in your example would be restricted to joining elements based on spatial adjacency. Perhaps I misunderstand the application of your example to solving this problem.

            – eric s
            Sep 12 '17 at 18:31







          • 1





            So you reduce the set by WHERE ST_Touches(x,y) or the like. The theoretical maximum is every element touches every other element. If the real world/spacetime or whatever prohibits that you just have to reduce from that set. The cross join is the theoretical maximum. The second things have real world constraints you're outside of that.

            – Evan Carroll
            Sep 12 '17 at 18:34












          • I don't think this will get the result I am after. The theoretical maximum is indeed limited by real-world spatial relationships. If I have a county with n ZIP codes and k of them are in group j, I want to know what the maximum possible number of joins possible would if k number of ZIP codes were reassigned to group j so as to maximize the join count. This likely requires an iterative solving algorithm, not a simple table query.

            – eric s
            Sep 13 '17 at 19:45











          • What do you think the word "theoretical" means vs "real world." I have no idea how you're assigning your variables there k is being used in two contexts.

            – Evan Carroll
            Sep 13 '17 at 21:31











          • "Hypothetical maximum" would perhaps be more accurate. I used "theoretical" to contrast with "actual." I asked in the context of applying a particular spatial statistic where I thought the meaning of "theoretical maximum" would be reasonably clear.

            – eric s
            Sep 13 '17 at 22:00


















          • Thank you. I am asking about joins based on spatial relationships. Each item can only be joined to spatial neighbors, not to each element in the set. Elements with value '1' in col 'x' in your example would be restricted to joining elements based on spatial adjacency. Perhaps I misunderstand the application of your example to solving this problem.

            – eric s
            Sep 12 '17 at 18:31







          • 1





            So you reduce the set by WHERE ST_Touches(x,y) or the like. The theoretical maximum is every element touches every other element. If the real world/spacetime or whatever prohibits that you just have to reduce from that set. The cross join is the theoretical maximum. The second things have real world constraints you're outside of that.

            – Evan Carroll
            Sep 12 '17 at 18:34












          • I don't think this will get the result I am after. The theoretical maximum is indeed limited by real-world spatial relationships. If I have a county with n ZIP codes and k of them are in group j, I want to know what the maximum possible number of joins possible would if k number of ZIP codes were reassigned to group j so as to maximize the join count. This likely requires an iterative solving algorithm, not a simple table query.

            – eric s
            Sep 13 '17 at 19:45











          • What do you think the word "theoretical" means vs "real world." I have no idea how you're assigning your variables there k is being used in two contexts.

            – Evan Carroll
            Sep 13 '17 at 21:31











          • "Hypothetical maximum" would perhaps be more accurate. I used "theoretical" to contrast with "actual." I asked in the context of applying a particular spatial statistic where I thought the meaning of "theoretical maximum" would be reasonably clear.

            – eric s
            Sep 13 '17 at 22:00

















          Thank you. I am asking about joins based on spatial relationships. Each item can only be joined to spatial neighbors, not to each element in the set. Elements with value '1' in col 'x' in your example would be restricted to joining elements based on spatial adjacency. Perhaps I misunderstand the application of your example to solving this problem.

          – eric s
          Sep 12 '17 at 18:31






          Thank you. I am asking about joins based on spatial relationships. Each item can only be joined to spatial neighbors, not to each element in the set. Elements with value '1' in col 'x' in your example would be restricted to joining elements based on spatial adjacency. Perhaps I misunderstand the application of your example to solving this problem.

          – eric s
          Sep 12 '17 at 18:31





          1




          1





          So you reduce the set by WHERE ST_Touches(x,y) or the like. The theoretical maximum is every element touches every other element. If the real world/spacetime or whatever prohibits that you just have to reduce from that set. The cross join is the theoretical maximum. The second things have real world constraints you're outside of that.

          – Evan Carroll
          Sep 12 '17 at 18:34






          So you reduce the set by WHERE ST_Touches(x,y) or the like. The theoretical maximum is every element touches every other element. If the real world/spacetime or whatever prohibits that you just have to reduce from that set. The cross join is the theoretical maximum. The second things have real world constraints you're outside of that.

          – Evan Carroll
          Sep 12 '17 at 18:34














          I don't think this will get the result I am after. The theoretical maximum is indeed limited by real-world spatial relationships. If I have a county with n ZIP codes and k of them are in group j, I want to know what the maximum possible number of joins possible would if k number of ZIP codes were reassigned to group j so as to maximize the join count. This likely requires an iterative solving algorithm, not a simple table query.

          – eric s
          Sep 13 '17 at 19:45





          I don't think this will get the result I am after. The theoretical maximum is indeed limited by real-world spatial relationships. If I have a county with n ZIP codes and k of them are in group j, I want to know what the maximum possible number of joins possible would if k number of ZIP codes were reassigned to group j so as to maximize the join count. This likely requires an iterative solving algorithm, not a simple table query.

          – eric s
          Sep 13 '17 at 19:45













          What do you think the word "theoretical" means vs "real world." I have no idea how you're assigning your variables there k is being used in two contexts.

          – Evan Carroll
          Sep 13 '17 at 21:31





          What do you think the word "theoretical" means vs "real world." I have no idea how you're assigning your variables there k is being used in two contexts.

          – Evan Carroll
          Sep 13 '17 at 21:31













          "Hypothetical maximum" would perhaps be more accurate. I used "theoretical" to contrast with "actual." I asked in the context of applying a particular spatial statistic where I thought the meaning of "theoretical maximum" would be reasonably clear.

          – eric s
          Sep 13 '17 at 22:00






          "Hypothetical maximum" would perhaps be more accurate. I used "theoretical" to contrast with "actual." I asked in the context of applying a particular spatial statistic where I thought the meaning of "theoretical maximum" would be reasonably clear.

          – eric s
          Sep 13 '17 at 22:00


















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Geographic Information Systems Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f255131%2ffind-maximum-theoretical-join-count-spatial-statistics%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          រឿង រ៉ូមេអូ និង ហ្ស៊ុយលីយេ សង្ខេបរឿង តួអង្គ បញ្ជីណែនាំ

          QGIS export composer to PDF scale the map [closed] Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Print Composer QGIS 2.6, how to export image?QGIS 2.8.1 print composer won't export all OpenCycleMap base layer tilesSave Print/Map QGIS composer view as PNG/PDF using Python (without changing anything in visible layout)?Export QGIS Print Composer PDF with searchable text labelsQGIS Print Composer does not change from landscape to portrait orientation?How can I avoid map size and scale changes in print composer?Fuzzy PDF export in QGIS running on macSierra OSExport the legend into its 100% size using Print ComposerScale-dependent rendering in QGIS PDF output

          PDF-ში გადმოწერა სანავიგაციო მენიუproject page