Chicago crime 2022 wards / Relational core

> n1 <- nrow(MT$nodes$primary); n2 <- nrow(MT$nodes$location); n3 <- nrow(MT$nodes$ward)
> C1 <- 1:n1; C2 <- 1:n2; C3 <- 1:n3
> F12 <- sapply(1:n1,function(u) pRel(MT,u,C2,"primary","location",way3="ward"))
> F21 <- sapply(1:n2,function(v) pRel(MT,v,C1,"location","primary",way3="ward"))
> table(F12)
F12
 4  6  7 13 33 37 39 46 47 49 50 
 2  1  1  2  1  1  1  1  1  3 17 
> table(F21)
F21
 1  2  3  4  5  6  7  8 10 11 14 16 17 18 19 21 24 25 27 30 31 32 33 34 35 36 37 38 39 40 42 43 45 
17  3  6  6  8  4  3  4  2  3  4  1  1  1  3  1  1  2  1  2  3  1  2  1  2  1  3  4  1  1  3  1  2 
46 47 48 49 50 
 3  2  1  4 27 
> PRel <- function(MN,u,C,way1,way2,...) pRel(MN,u,C,way1,way2,way3="ward",...)
> Rcore <- Gen2modeCore(MT,"primary","location",PRel,PRel,49,49)
> Rcore
$core1
 [1]  1  2  3  4  6  7  8  9 14 17 18 21 23 26 27 28 30 31
$core2
 [1]   1  17  19  25  27  42  47  49  52  62  64  65  72  75  90  93  95 103 104 105 106 107 111 112
[25] 113 114 116 117 120 122 132
> Rcore <- Gen2modeCore(MT,"primary","location",PRel,PRel,50,50)
> Rcore
$core1
 [1]  1  2  3  4  6  7  8  9 17 18 21 23 26 27 28 30 31
$core2
 [1]   1  17  19  25  42  47  49  62  64  65  72  75  90  93  95 103 104 105 106 107 113 114 116 117
[25] 120 132
> Cprim <- Rcore$core1; Cloc <- Rcore$core2
> FCp <- sapply(Cprim,function(u) pRel(MT,u,Cloc,"primary","location",way3="ward"))
> names(FCp) <- MT$nodes$primary$ID[Cprim]
> rev(sort(FCp))
         WEAPONS VIOLATION                      THEFT                SEX OFFENSE 
                        50                         50                         50 
                   ROBBERY     PUBLIC PEACE VIOLATION              OTHER OFFENSE 
                        50                         50                         50 
OFFENSE INVOLVING CHILDREN                  NARCOTICS        MOTOR VEHICLE THEFT 
                        50                         50                         50 
        DECEPTIVE PRACTICE          CRIMINAL TRESPASS    CRIMINAL SEXUAL ASSAULT 
                        50                         50                         50 
           CRIMINAL DAMAGE                   BURGLARY                    BATTERY 
                        50                         50                         50 
                   ASSAULT                      ARSON 
                        50                         50 
> FCl <- sapply(Cloc,function(u) pRel(MT,u,Cprim,"location","primary",way3="ward"))
> names(FCl) <- MT$nodes$location$ID[Cloc]
> rev(sort(FCl))
                VEHICLE NON-COMMERCIAL                                 STREET 
                                    50                                     50 
                    SMALL RETAIL STORE                               SIDEWALK 
                                    50                                     50 
               SCHOOL - PUBLIC GROUNDS               SCHOOL - PUBLIC BUILDING 
                                    50                                     50 
                            RESTAURANT        RESIDENCE - YARD (FRONT / BACK) 
                                    50                                     50 
           RESIDENCE - PORCH / HALLWAY                     RESIDENCE - GARAGE 
                                    50                                     50 
                             RESIDENCE PARKING LOT / GARAGE (NON RESIDENTIAL) 
                                    50                                     50 
                         PARK PROPERTY                        OTHER (SPECIFY) 
                                    50                                     50 
                    GROCERY FOOD STORE                            GAS STATION 
                                    50                                     50 
                            DRUG STORE                 DRIVEWAY - RESIDENTIAL 
                                    50                                     50 
                      DEPARTMENT STORE                      CONVENIENCE STORE 
                                    50                                     50 
          COMMERCIAL / BUSINESS OFFICE  CHURCH / SYNAGOGUE / PLACE OF WORSHIP 
                                    50                                     50 
                                  BANK                              APARTMENT 
                                    50                                     50 
                                 ALLEY                                        
                                    50                                     50 
vlado/work/2m/mwn/x3d/ccwrcore.txt · Last modified: 2023/01/31 02:09 by vlado
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki