# Statistics

### Identify hotspots of specific Point of Interest type&#x20;

<table data-full-width="false"><thead><tr><th align="center">CARTO DW</th><th width="154" align="center">BigQuery</th><th align="center">Snowflake</th><th align="center">Redshift</th><th align="center">PostgreSQL</th><th data-hidden>Snowflake</th><th data-hidden>Redshift</th><th data-hidden>PostgreSQL</th><th data-hidden>CARTO DW</th></tr></thead><tbody><tr><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td><td></td><td></td><td></td><td></td></tr></tbody></table>

This example demonstrates how to identify hotspots using Getis Ors Gi\* statistic. We use OpenStreetMap amenity POIs in Stockholm.

Read [this full guide](https://docs.carto.com/data-and-analysis/analytics-toolbox-for-bigquery/examples/identifying-amenity-hotspots-in-stockholm) to learn more.

[**Download example**](https://storage.googleapis.com/carto-workflows-examples/files/poi_hotspot.sql)

<figure><img src="https://content.gitbook.com/content/FEElAdsRIl9DzfMhbRlB/blobs/NWBvCAFnXUzH1PHfNmec/Screenshot%202023-10-20%20at%2018.41.47.png" alt=""><figcaption></figcaption></figure>

### Space-time hotspot analysis&#x20;

<table data-full-width="false"><thead><tr><th align="center">CARTO DW</th><th width="154" align="center">BigQuery</th><th align="center">Snowflake</th><th align="center">Redshift</th><th align="center">PostgreSQL</th><th data-hidden>Snowflake</th><th data-hidden>Redshift</th><th data-hidden>PostgreSQL</th><th data-hidden>CARTO DW</th></tr></thead><tbody><tr><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td><td></td><td></td><td></td><td></td></tr></tbody></table>

This example shows how to identify spacetime clusters. In particular, we will perform space temporal analysis to identify traffic accident hotspots using the location and time of accidents in the city of Barcelona in 2018.

Spacetime hotspots are computed using an extension of the Getis Ord Gi\* statistics that measures the degree to which data values are clustered together in space and time.

[**Download example**](https://storage.googleapis.com/carto-workflows-examples/files/space_time_hotspot.sql)

<div align="left"><figure><img src="https://content.gitbook.com/content/FEElAdsRIl9DzfMhbRlB/blobs/J1msTa8xVvehk0obYemB/Screenshot%202023-10-25%20at%2016.55.08.png" alt=""><figcaption></figcaption></figure></div>

### Spacetime hotspot classification: Understanding collision patterns&#x20;

<table data-full-width="false"><thead><tr><th align="center">CARTO DW</th><th width="154" align="center">BigQuery</th><th align="center">Snowflake</th><th align="center">Redshift</th><th align="center">PostgreSQL</th><th data-hidden>Snowflake</th><th data-hidden>Redshift</th><th data-hidden>PostgreSQL</th><th data-hidden>CARTO DW</th></tr></thead><tbody><tr><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td><td></td><td></td><td></td><td></td></tr></tbody></table>

This example shows how to use Workflows to identify space-time clusters and classify them according to their behavior over time.

Read [this guide](https://academy.carto.com/advanced-spatial-analytics/spatial-analytics-for-bigquery/step-by-step-tutorials/spacetime-hotspot-classification-understanding-collision-patterns) to learn more.

[**Download example**](https://storage.googleapis.com/carto-workflows-examples/files/spacetime_hotspot_classification.sql)

<figure><img src="https://storage.googleapis.com/carto-workflows-examples/img/Spacetime%20Hotspot%20Classification%20Understanding%20Collision%20Patterns.png" alt=""><figcaption></figcaption></figure>

### Time series clustering: Identifying areas with similar traffic accident patterns

<table data-full-width="false"><thead><tr><th align="center">CARTO DW</th><th width="154" align="center">BigQuery</th><th align="center">Snowflake</th><th align="center">Redshift</th><th align="center">PostgreSQL</th><th data-hidden>Snowflake</th><th data-hidden>Redshift</th><th data-hidden>PostgreSQL</th><th data-hidden>CARTO DW</th></tr></thead><tbody><tr><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td><td></td><td></td><td></td><td></td></tr></tbody></table>

This example shows how to use Workflows to identify areas with similar traffic accident patterns over time using their location and time.

Read [this guide](https://academy.carto.com/advanced-spatial-analytics/spatial-analytics-for-bigquery/step-by-step-tutorials/time-series-clustering-identifying-areas-with-similar-traffic-accident-patterns) to learn more.

[**Download example**](https://storage.googleapis.com/carto-workflows-examples/files/time_series_clustering.sql)

<figure><img src="https://storage.googleapis.com/carto-workflows-examples/img/Time%20Series%20Clustering%20Identifying%20Areas%20with%20Similar%20Traffic%20Accident%20Patterns.png" alt=""><figcaption></figcaption></figure>

### Computing the spatial auto-correlation of point of interest locations&#x20;

<table data-full-width="false"><thead><tr><th align="center">CARTO DW</th><th width="154" align="center">BigQuery</th><th align="center">Snowflake</th><th align="center">Redshift</th><th align="center">PostgreSQL</th><th data-hidden>Snowflake</th><th data-hidden>Redshift</th><th data-hidden>PostgreSQL</th><th data-hidden>CARTO DW</th></tr></thead><tbody><tr><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td><td></td><td></td><td></td><td></td></tr></tbody></table>

This example demonstrates how to use Workflows to analyze the spatial correlation of POI locations in Berlin using OpenStreetMap data and the Moran’s I function available in the statistics module.

Read [this](https://docs.carto.com/data-and-analysis/analytics-toolbox-for-bigquery/examples/computing-the-spatial-autocorrelation-of-pois-locations-in-berlin) guide to learn more.

[**Download example**](https://storage.googleapis.com/carto-workflows-examples/files/poi_spatial_autocorrelation.sql)

<figure><img src="https://content.gitbook.com/content/FEElAdsRIl9DzfMhbRlB/blobs/DsZ6AMO3atXerc3xxS5j/Screenshot%202023-10-25%20at%2013.04.53.png" alt=""><figcaption></figcaption></figure>

### Applying GWR to model the local spatial relationships in your data

<table data-full-width="false"><thead><tr><th align="center">CARTO DW</th><th width="154" align="center">BigQuery</th><th align="center">Snowflake</th><th align="center">Redshift</th><th align="center">PostgreSQL</th><th data-hidden>Snowflake</th><th data-hidden>Redshift</th><th data-hidden>PostgreSQL</th><th data-hidden>CARTO DW</th></tr></thead><tbody><tr><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td><td></td><td></td><td></td><td></td></tr></tbody></table>

This example demonstrate how to use Worklfows to apply a Geographically Weighted Regression model to find relationships between a set of predictor variables and an outcome of interest.

In this case, we're going to analyze the relationship between Airbnb’s listings in Berlin and the number of bedrooms and bathrooms available at these listings.

Read [this full guide](https://docs.carto.com/data-and-analysis/analytics-toolbox-for-bigquery/examples/applying-gwr-to-understand-airbnb-listings-prices) to learn more.&#x20;

[**Download example**](https://storage.googleapis.com/carto-workflows-examples/files/gwr.sql)

<div align="left"><figure><img src="https://content.gitbook.com/content/FEElAdsRIl9DzfMhbRlB/blobs/KK8tJfT1jzI68nWC3muy/Screenshot%202023-10-19%20at%2016.00.55.png" alt="" width="563"><figcaption></figcaption></figure></div>

### Create a composite score with the supervised method (BigQuery)

<table data-full-width="false"><thead><tr><th align="center">CARTO DW</th><th width="154" align="center">BigQuery</th><th align="center">Snowflake</th><th align="center">Redshift</th><th align="center">PostgreSQL</th><th data-hidden>Snowflake</th><th data-hidden>Redshift</th><th data-hidden>PostgreSQL</th><th data-hidden>CARTO DW</th></tr></thead><tbody><tr><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td><td></td><td></td><td></td><td></td></tr></tbody></table>

A [composite indicator](https://academy.carto.com/advanced-spatial-analytics/spatial-analytics-for-bigquery/step-by-step-tutorials/how-to-create-a-composite-score-with-your-spatial-data#computing-a-composite-score-supervised-method) is an aggregation of variables which aims to measure complex and multidimensional concepts which are difficult to define, and cannot be measured directly. Examples include [innovation](https://en.wikipedia.org/wiki/Global_Innovation_Index), [human development](https://en.wikipedia.org/wiki/Human_Development_Index) or [environmental performance](https://en.wikipedia.org/wiki/Environmental_Performance_Index).

[**Download example**](https://storage.googleapis.com/carto-workflows-examples/files/composite-score-supervised.sql)

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2Fq1DGJ0KMzkuWPFZOYhIz%2FScreenshot%202024-02-29%20at%2016.38.45.png?alt=media&#x26;token=d54e9117-4a41-4da4-91d4-74f6c9015085" alt=""><figcaption></figcaption></figure>

### Create a composite score with the unsupervised method (BigQuery)

<table data-full-width="false"><thead><tr><th align="center">CARTO DW</th><th width="154" align="center">BigQuery</th><th align="center">Snowflake</th><th align="center">Redshift</th><th align="center">PostgreSQL</th><th data-hidden>Snowflake</th><th data-hidden>Redshift</th><th data-hidden>PostgreSQL</th><th data-hidden>CARTO DW</th></tr></thead><tbody><tr><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td><td></td><td></td><td></td><td></td></tr></tbody></table>

A [composite indicator](https://academy.carto.com/advanced-spatial-analytics/spatial-analytics-for-bigquery/step-by-step-tutorials/how-to-create-a-composite-score-with-your-spatial-data#computing-a-composite-score-supervised-method) is an aggregation of variables which aims to measure complex and multidimensional concepts which are difficult to define, and cannot be measured directly. Examples include [innovation](https://en.wikipedia.org/wiki/Global_Innovation_Index), [human development](https://en.wikipedia.org/wiki/Human_Development_Index), [environmental performance](https://en.wikipedia.org/wiki/Environmental_Performance_Index), and so on.

In this example, we will use the [Create Score Unsupervised](https://docs.carto.com/carto-user-manual/workflows/components/statistics#composite-score-unsupervised) component, to identify areas in Milan with a larger market potential for a wellness & beauty center mainly aimed for teenage and adult women.

[**Download example**](https://storage.googleapis.com/carto-workflows-examples/files/composite-score-unsupervised.sql)

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2FdbqxEqxMgD3b7xLAacma%2FScreenshot%202024-02-29%20at%2017.00.55.png?alt=media&#x26;token=949dc1e4-6965-4b33-bec1-2607d5908283" alt=""><figcaption></figcaption></figure>

### Detect Space-time anomalies

<table data-full-width="false"><thead><tr><th align="center">CARTO DW</th><th width="154" align="center">BigQuery</th><th align="center">Snowflake</th><th align="center">Redshift</th><th align="center">PostgreSQL</th><th data-hidden>Snowflake</th><th data-hidden>Redshift</th><th data-hidden>PostgreSQL</th><th data-hidden>CARTO DW</th></tr></thead><tbody><tr><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td><td></td><td></td><td></td><td></td></tr></tbody></table>

This example workflow uses the Detect Space-time Anomalies component to find the most significant clusters of anomalous data.

We’ll create a workflow to improve portfolio management for real estate insurers by identifying vacant buildings in areas experiencing anomalously high rates of violent crime.

[**Download example**](https://storage.googleapis.com/carto-workflows-examples/files/statistics_detect_spacetime_anomalies.sql)

<figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2F4srcXo2GpjRTLMNHqFc4%2Fstatistics_detect_spacetime_anomalies.png?alt=media&#x26;token=21571806-66db-4169-a948-6d00ea3b49c1" alt=""><figcaption></figcaption></figure>
