Tutorial #1 - Crime analysis. How to conduct statistic analysis and visualize data on a map

Lampyre lets you easily process big volumes of data and conveniently shapes statistic info for easy studying and further analysis. It provides you with a set of tools for building graphs of different connection types and with a feature of overlapping all aggregated results over a map or a timeline. All this considerably saves time when you have a lot of analytical tasks, no matter your area of expertise.

Now we will make a statistic analysis of criminal activity in Los Angeles since 2010 and of real estate data costs in the same city. We will also correlate the results and show you what we can get from it.

We'll be working with location info and see how such data may be visualized and filtered on and by a map.

In Lampyre you can work with any structured data by uploading it into the system or by obtaining it with the help of different requests.

In our case we'll be working with offline data, which was obtained from open sources.

As it will be uploaded into the system manually, we launch Lampyre in the standalone mode. To do this we tick this checkbox in the system start up window.

Figure 1

In order to start working you have to create an investigation or to open a previously created one. You can do this with start "List of requests" window.

Figure 2

Also you can use the “File” main menu. All the tools for creating a new or opening an existing investigation are there in the context menu.

Figure 3 Figure 4

Alternatively you can click this button Button 1 in the quick access toolbar in the upper part of the main window or use hot keys (Ctrl+Shift+N).

Now that our investigation is created we can start uploading. Our data is a csv table file which is ready to be imported.

We go to the "Windows" main menu and then choose “Import”. In the pop up window we select our file.

Figure 5 Figure 6

It can be imported either into repository or just into our investigation. If you import into repository the data will be available to work with in all your investigations.

In this pop up window, apart from the file or multiple files to import, you can also set some import parameters.

Figure 7 Figure 8

Our file was successfully imported. By double clicking it in the Import window we open it in a table mode:

Figure 9

In the "Windows" main menu we choose "Content" which opens the "Content" window with statistics on this table data.

Figure 10

Let's filter our data by time, and work only with crimes commited in 2018 to get more relevant results. In the Date_Occurred column header we click the filter sign:

Figure 11

Then we go to the "Text filters" tab, we set the filter to "Ends with 2018" and click ok. So this way we'll be working only with data of year 2018.

Figure 12

Let's save the filtered data as a new table by pressing Ctrl+N hot key combination on your keyboard.

Now we switch to the "Explorer" window (for example by choosing it in the "Windows" main menu) and rename this new table into Crimes2018. We can rename it 3 different ways:

  • We click the new table, then press F2 and edit its name.
  • Or we right-click it and choose Rename in the context menu.
  • Or we click the table once, to select it, and then click it one more time to make it editable.
Figure 13 Figure 14

Now we'll be working with this new table. In the "Content" window, we see different statistics. We can easily see the figures for the crimes involving, For example, vehicles and 26-year old women.

To make it more comfortable - From the "Content" window or from the table itself we drag the Crime Code Description column into the "Wizard" section, which is in the upper part of the "Content" window:

Figure 15 Figure 16

Then we combine columns Victim Age and Victim Sex in the "Wizard", into a so called tuple condition: by dragging them there the same way. Note that the tuple condition requires dropping the 2nd column right after the 1st one.

Figure 17

These figures are the statistics for this tuple condition:

Figure 18

Now we'll pick some crime type: in the Crime Code Description we right-click the BURGLARY FROM VEHICLE and choose refine in the context menu. The table is filtered by this crime type, and of course the statistics is changed.

Figure 19

Now let's expand the full list by clicking "More" to the right of our tuple filter condition. You can click it multiple times until you see everything that is there.

Figure 20

We see that there were 207 crimes of this type against 26-year-old women. We click 26; F in the list and choose "Show" in the context window.

Instantly we've got the corresponding data selected in the table.

Figure 21

If your data has coordinates, you can analyse it with the help of a map. Lampyre visualizes the geo-location.

We create a map by right-clicking our investigation name in the "Explorer" window and by choosing "New GIS Map" in the context menu:

Figure 22

For our convenience let’s place our table under the map. We choose our table in the tabs here and drag it down. A pop-up menu appears which let’s you choose where to place your tab.

Figure 23

We choose the area that we need and drop the tab.

Figure 24

Now when we're working with the map we'll use the cross-module feature and work with the same data in different visualization modes. In this case by clicking on table rows we see the same data visualized on the map.

Figure 25

If we select all the rows in our table, on the map we'll see a polygon area inside which all the incidents of the selected rows occurred. So we press Ctrl+A on our keyboard and get an area where 26-year-old women were robbed off their bicycles in 2018.

Figure 26

The cross-module feature also works the other way around - when you select an area on your map, the appropriate data in your table will be selected as well. We click the rectangle button Button 2 in map window menu to activate this selection tool:

Figure 27

And with it we select some area on our map by holding the mouse button. When we release the button we see that the data in our table has changed:

Figure 28

Also with the help of the "Wizard", which we previously used in the "Content" window, we can find, for example, the crimes with the biggest number of weapon types used.

Similar to the way we did with our "tuple" condition, we’ll do the same with columns Crime Code Description and Weapon Description but create a so called "group" condition.

For this we drag the Crime Code Description to the "Wizard" and then we drag there the Weapon Description column, but we drop it into the square area next to the Crime Code Description, not after it.

Figure 29

As a result for each Crime Code Description value we get the number of unique Weapon Description values.

Figure 30

In a similar way, let’s take a look at the events of our current interest both in the table and on the map. We right-click the created group condition and choose "Show" in the context menu.

Figure 31

As you see the data in the table changed right away. Next, holding the left mouse button we can select some values in the table. As we do this we see that the area, corresponding to these selected values, is selected on the map.

Figure 32

With the help of this statistics it’s easy to find out which area has the highest criminal activity but it would be more efficient to see the position of these areas on the map.

To complete this task let’s import a .kml file with shapes which set the borders of the districts of the city under our analysis. In the map window menu we click this sign Button 3 and upload the file:

Figure 33 Figure 34 Figure 35

We got the districts layered on our map. Now we select the shapes of our district layer to create an aggregation layer by the quantity of crimes: hold the Alt button and click once on the selected area on the map, or click the needed layer - LA - in the "Explorer" window.

Figure 36

This is what we get:

Figure 37

Now let's change the opacity of the imported layer. We open the "Properties" window, then we double click the LA layer in the "Explorer" window. We can change the "Background colour" and "Opacity".

Figure 38 Figure 39

Now for the selected districts we'll make an aggregation layer by the quantity of crimes. For this in the map menu we click this button Button 4, then from the crimes2018 drop-down list we choose "Quantity".

Figure 40

After this, in the "Explorer" window we untick "Shapes" and tick the aggregation layer:

Figure 41

This is what we get:

Figure 42

In our case colour palette indicates in what city district there were more crimes. Blue means less crimes, red - more. The most criminal district in 2018 is the one highlighted in red.

Now let’s get back to our cross-module feature again: when selecting a certain district on the map, the incidents of this district are selected in the table.

Now let’s add to our investigation some data on the real estate prices in different districts of the city.

To make our work easier we’ll change the colour of the previously created aggregation layer into red. In the "Explorer" window we tick this layer.

Figure 43

Then we open the "Properties" window and change the "Color" parameter into red. We’ll pick the colour from the "Custom" palette.

Figure 44 Figure 45

Here is our result.

Figure 46

In the "Explorer" window the system also indicated the change of colour:

Figure 47

We open the "Import" window and upload 3 new files of the same structure and kind into our investigation. We select all files at once and choose to unite them. Also we ask the system to upload only unique rows of your tables, deleting the repeated ones.

Figure 48

We wait till the files are processed by the system.

Figure 49

We click our uploaded data result in the "Import" window and open this data in a table.

Figure 50

Now let’s create an aggregation layer by the average price value. We open the appropriate pop-up window by clicking the layer creation button in the map menu. We choose the real estate file and create an aggregation layer by price value.

Figure 51

We see that one more layer appeared in the "Explorer" window.

Figure 52

And we see the corresponding result on the map.

Figure 53

As in our case we have 2 layers on the map - by average price and by number of crimes - their colours overlap. So to see what we have clearly, we change the colour of the new layer. Let’s also downsize the boarder thickness and opacity of all our layers.

In the "Explorer" window we select the aggregation by price layer, then in the "Properties" window we change its colour into blue. We choose colour from the "Custom" palette.

Figure 54

Now in the Explorer window, holding the Ctrl key, we select both aggregation layers:

Figure 55

We open the "Properties" window and change the "Border thickness" from 5 to 1:

Figure 56

This is what we get as a result:

Figure 57

We see that the brighter our blue is the more expensive the estate is. The brighter the red - the higher the level of crime.

This way we fulfilled our goal and as a result we see that the average real estate property prices are cheaper in the district with the highest crime level and vice versa as the red and blue areas do not intersect.

We can study in more details the statistical data on property, which is being sold in the district of the highest crime level.

We click the area highlighted in bright red and open the table with the real estate prices.

Figure 58

Now let’s see what crimes are committed in the districts with the most expensive estate. Click the bright blue district and open the table with crime data.

Figure 59

Thus we conducted data analysis and visualized the correlation between different data types with the help of a map and without creating any objects or links.

You can try this technique with any other data to fulfil your own analytical tasks.