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 the help of hot keys (CTRL+SHIFT+N) or through the “File” Main Menu. Alternatively you can click this button Button 1 in the quick access toolbar in the upper part of the main window.

Figure 2 Figure 3

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 4 Figure 5

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 6 Figure 7

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

Figure 8

In the Windows main menu we choose Content

Which opens the Content window with statistics on this table data

Figure 9

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 10

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 11

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 12 Figure 13

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 14 Figure 15

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 16

These figures are the statistics for this tuple condition:

Figure 17

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 18

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 19

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 20

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 21

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 22

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

Figure 23

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 24

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 25

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 26

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 27

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 28

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

Figure 29

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 30

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 31

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 32 Figure 33 Figure 34

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 35

This is what we get:

Figure 36

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 37 Figure 38

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 39

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

Figure 40

This is what we get.

Figure 41

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 42

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

Figure 43 Figure 44

Here is our result.

Figure 45

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

Figure 46

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 47

We wait till the files are processed by the system

Figure 48

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

Figure 49

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 50

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

Figure 51

And we see the corresponding result on the map.

Figure 52

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 53

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

Figure 54

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

Figure 55

This is what we get as a result

Figure 56

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 57

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 58

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.