<td>Data stream <ahref="../../datastreams/data-streams-introduction/">container</a> (database table, CSV file, etc.) where the location data is stored</td>
</tr>
<tr>
<td><code>[LOCATIONS_TO_USE]</code></td>
<td>Type of location data to use, one of <code>ALL</code>, <code>GPS</code>, <code>ALL_RESAMPLED</code> or <code>FUSED_RESAMPLED</code>. This filter is based on the <code>provider</code> column of the locations table, <code>ALL</code> includes every row, <code>GPS</code> only includes rows where the provider is gps, <code>ALL_RESAMPLED</code> includes all rows after being resampled, and <code>FUSED_RESAMPLED</code> only includes rows where the provider is fused after being resampled.</td>
<td>if <code>ALL_RESAMPLED</code> or <code>FUSED_RESAMPLED</code> is used, the original fused data has to be resampled, a location row is resampled to the next valid timestamp (see the Assumptions/Observations below) only if the time difference between them is less or equal than this threshold (in minutes).</td>
<td>if <code>ALL_RESAMPLED</code> or <code>FUSED_RESAMPLED</code> is used, the original fused data has to be resampled, a location row is resampled at most for this long (in minutes)</td>
Android and iOS clients can collect location coordinates through the phone’s GPS, the network cellular towers around the phone, or Google’s fused location API. </p>
<ul>
<li>If you want to use only the GPS provider, set <code>[LOCATIONS_TO_USE]</code> to <code>GPS</code></li>
<li>If you want to use all providers, set <code>[LOCATIONS_TO_USE]</code> to <code>ALL</code></li>
<li>If you collected location data from different providers, including the fused API, use <code>ALL_RESAMPLED</code></li>
<li>If your mobile client was configured to use fused location only or want to focus only on this provider, set <code>[LOCATIONS_TO_USE]</code> to <code>RESAMPLE_FUSED</code>.</li>
</ul>
<p><code>ALL_RESAMPLED</code> and <code>RESAMPLE_FUSED</code> take the original location coordinates and replicate each pair forward in time as long as the phone was sensing data as indicated by the joined timestamps of <ahref="../phone-data-yield/"><code>[PHONE_DATA_YIELD][SENSORS]</code></a>. This is done because Google’s API only logs a new location coordinate pair when it is sufficiently different in time or space from the previous one and because GPS and network providers can log data at variable rates.</p>
<p>There are two parameters associated with resampling fused location.</p>
<ol>
<li><code>FUSED_RESAMPLED_CONSECUTIVE_THRESHOLD</code> (in minutes, default 30) controls the maximum gap between any two coordinate pairs to replicate the last known pair. For example, participant A’s phone did not collect data between 10.30 am and 10:50 am and between 11:05am and 11:40am, the last known coordinate pair is replicated during the first period but not the second. In other words, we assume that we cannot longer guarantee the participant stayed at the last known location if the phone did not sense data for more than 30 minutes. </li>
<li><code>FUSED_RESAMPLED_TIME_SINCE_VALID_LOCATION</code> (in minutes, default 720 or 12 hours) stops the last known fused location from being replicated longer than this threshold even if the phone was sensing data continuously. For example, participant A went home at 9 pm, and their phone was sensing data without gaps until 11 am the next morning, the last known location is replicated until 9 am. </li>
</ol>
<p>If you have suggestions to modify or improve this resampling, let us know.</p>
<p>These features are based on the original open-source implementation by <ahref="../../citation#barnett-locations">Barnett et al</a> and some features created by <ahref="../../citation#barnett-locations">Canzian et al</a>.</p>
<divclass="admonition info">
<pclass="admonition-title">Available time segments and platforms</p>
<ul>
<li>Available only for segments that start at 00:00:00 and end at 23:59:59 of the same or a different day (daily, weekly, weekend, etc.)</li>
<td>Set to <code>True</code> to extract <code>PHONE_LOCATIONS</code> features from the <code>BARNETT</code> provider</td>
</tr>
<tr>
<td><code>[FEATURES]</code></td>
<td>Features to be computed, see table below</td>
</tr>
<tr>
<td><code>[ACCURACY_LIMIT]</code></td>
<td>An integer in meters, any location rows with an accuracy higher than this is dropped. This number means there’s a 68% probability the actual location is within this radius</td>
</tr>
<tr>
<td><code>[IF_MULTIPLE_TIMEZONES]</code></td>
<td>Currently, <code>USE_MOST_COMMON</code> is the only value supported. If the location data for a participant belongs to multiple time zones, we select the most common because Barnett’s algorithm can only handle one time zone</td>
</tr>
<tr>
<td><code>[MINUTES_DATA_USED]</code></td>
<td>Set to <code>True</code> to include an extra column in the final location feature file containing the number of minutes used to compute the features on each time segment. Use this for quality control purposes; the more data minutes exist for a period, the more reliable its features should be. For fused location, a single minute can contain more than one coordinate pair if the participant is moving fast enough.</td>
</tr>
</tbody>
</table>
<p>Features description for <code>[PHONE_LOCATIONS][PROVIDERS][BARNETT]</code> adapted from <ahref="http://wiki.beiwe.org/wiki/Summary_Statistics">Beiwe Summary Statistics</a>:</p>
<table>
<thead>
<tr>
<th>Feature</th>
<th>Units</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>hometime</td>
<td>minutes</td>
<td>Time at home. Time spent at home in minutes. Home is the most visited significant location between 8 pm and 8 am, including any pauses within a 200-meter radius.</td>
</tr>
<tr>
<td>disttravelled</td>
<td>meters</td>
<td>Total distance traveled over a day (flights).</td>
</tr>
<tr>
<td>rog</td>
<td>meters</td>
<td>The Radius of Gyration (rog) is a measure in meters of the area covered by a person over a day. A centroid is calculated for all the places (pauses) visited during a day, and a weighted distance between all the places and that centroid is computed. The weights are proportional to the time spent in each place.</td>
</tr>
<tr>
<td>maxdiam</td>
<td>meters</td>
<td>The maximum diameter is the largest distance between any two pauses.</td>
</tr>
<tr>
<td>maxhomedist</td>
<td>meters</td>
<td>The maximum distance from home in meters.</td>
</tr>
<tr>
<td>siglocsvisited</td>
<td>locations</td>
<td>The number of significant locations visited during the day. Significant locations are computed using k-means clustering over pauses found in the whole monitoring period. The number of clusters is found iterating k from 1 to 200 stopping until the centroids of two significant locations are within 400 meters of one another.</td>
</tr>
<tr>
<td>avgflightlen</td>
<td>meters</td>
<td>Mean length of all flights.</td>
</tr>
<tr>
<td>stdflightlen</td>
<td>meters</td>
<td>Standard deviation of the length of all flights.</td>
</tr>
<tr>
<td>avgflightdur</td>
<td>seconds</td>
<td>Mean duration of all flights.</td>
</tr>
<tr>
<td>stdflightdur</td>
<td>seconds</td>
<td>The standard deviation of the duration of all flights.</td>
</tr>
<tr>
<td>probpause</td>
<td>-</td>
<td>The fraction of a day spent in a pause (as opposed to a flight)</td>
</tr>
<tr>
<td>siglocentropy</td>
<td>nats</td>
<td>Shannon’s entropy measurement is based on the proportion of time spent at each significant location visited during a day.</td>
</tr>
<tr>
<td>circdnrtn</td>
<td>-</td>
<td>A continuous metric quantifying a person’s circadian routine that can take any value between 0 and 1, where 0 represents a daily routine completely different from any other sensed days and 1 a routine the same as every other sensed day.</td>
</tr>
<tr>
<td>wkenddayrtn</td>
<td>-</td>
<td>Same as circdnrtn but computed separately for weekends and weekdays.</td>
Barnett’s features are only available on time segments that span entire days (00:00:00 to 23:59:59). Such segments can be one-day long (daily) or multi-day (weekly, for example). Multi-day segment features are computed based on daily features summarized the following way:</p>
<ul>
<li>sum for <code>hometime</code>, <code>disttravelled</code>, <code>siglocsvisited</code>, and <code>minutes_data_used</code></li>
<li>max for <code>maxdiam</code>, and <code>maxhomedist</code></li>
<li>mean for <code>rog</code>, <code>avgflightlen</code>, <code>stdflightlen</code>, <code>avgflightdur</code>, <code>stdflightdur</code>, <code>probpause</code>, <code>siglocentropy</code>, <code>circdnrtn</code>, <code>wkenddayrtn</code>, and <code>minsmissing</code></li>
</ul>
<p><strong>Computation speed</strong>
The process to extract these features can be slow compared to other sensors and providers due to the required simulation.</p>
<p><strong>How are these features computed?</strong>
These features are based on a Pause-Flight model. A pause is defined as a mobility trace (location pings) within a certain duration and distance (by default, 300 seconds and 60 meters). A flight is any mobility trace between two pauses. Data is resampled and imputed before the features are computed. See <ahref="../../citation#barnett-locations">Barnett et al</a> for more information. In RAPIDS, we only expose one parameter for these features (accuracy limit). You can change other parameters in <code>src/features/phone_locations/barnett/library/MobilityFeatures.R</code>.</p>
<p><strong>Significant Locations</strong>
Significant locations are determined using K-means clustering on pauses longer than 10 minutes. The number of clusters (K) is increased until no two clusters are within 400 meters from each other. After this, pauses within a certain range of a cluster (200 meters by default) count as a visit to that significant location. This description was adapted from the Supplementary Materials of <ahref="../../citation#barnett-locations">Barnett et al</a>.</p>
<p><strong>The Circadian Calculation</strong>
For a detailed description of how this is calculated, see <ahref="../../citation#barnett-locations">Canzian et al</a>.</p>
<td>Set to <code>True</code> to extract <code>PHONE_LOCATIONS</code> features from the <code>BARNETT</code> provider</td>
</tr>
<tr>
<td><code>[FEATURES]</code></td>
<td>Features to be computed, see table below</td>
</tr>
<tr>
<td><code>[ACCURACY_LIMIT]</code></td>
<td>An integer in meters, any location rows with an accuracy higher than this will be dropped. This number means there’s a 68% probability the true location is within this radius</td>
</tr>
<tr>
<td><code>[DBSCAN_EPS]</code></td>
<td>The maximum distance in meters between two samples for one to be considered as in the neighborhood of the other. This is not a maximum bound on the distances of points within a cluster. This is the most important DBSCAN parameter to choose appropriately for your data set and distance function.</td>
</tr>
<tr>
<td><code>[DBSCAN_MINSAMPLES]</code></td>
<td>The number of samples (or total weight) in a neighborhood for a point to be considered as a core point of a cluster. This includes the point itself.</td>
</tr>
<tr>
<td><code>[THRESHOLD_STATIC]</code></td>
<td>It is the threshold value in km/hr which labels a row as Static or Moving.</td>
</tr>
<tr>
<td><code>[MAXIMUM_ROW_GAP]</code></td>
<td>The maximum gap (in seconds) allowed between any two consecutive rows for them to be considered part of the same displacement. If this threshold is too high, it can throw speed and distance calculations off for periods when the phone was not sensing.</td>
</tr>
<tr>
<td><code>[MAXIMUM_ROW_DURATION]</code></td>
<td>The time difference between any two consecutive rows <code>A</code> and <code>B</code> is considered as the time a participant spent in <code>A</code>. If this difference is bigger than MAXIMUM_ROW_GAP we substitute it with <code>MAXIMUM_ROW_DURATION</code>.</td>
</tr>
<tr>
<td><code>[MINUTES_DATA_USED]</code></td>
<td>Set to <code>True</code> to include an extra column in the final location feature file containing the number of minutes used to compute the features on each time segment. Use this for quality control purposes; the more data minutes exist for a period, the more reliable its features should be. For fused location, a single minute can contain more than one coordinate pair if the participant is moving fast enough.</td>
</tr>
<tr>
<td><code>[SAMPLING_FREQUENCY]</code></td>
<td>Expected time difference between any two location rows in minutes. If set to <code>0</code>, the sampling frequency will be inferred automatically as the median of all the differences between two consecutive row timestamps (recommended if you are using <code>FUSED_RESAMPLED</code> data). This parameter impacts all the time calculations.</td>
</tr>
<tr>
<td><code>[CLUSTER_ON]</code></td>
<td>Set this flag to <code>PARTICIPANT_DATASET</code> to create clusters based on the entire participant’s dataset or to <code>TIME_SEGMENT</code> to create clusters based on all the instances of the corresponding time segment (e.g. all mornings).</td>
</tr>
<tr>
<td><code>[CLUSTERING_ALGORITHM]</code></td>
<td>The original Doryab et al. implementation uses <code>DBSCAN</code>, <code>OPTICS</code> is also available with similar (but not identical) clustering results and lower memory consumption.</td>
</tr>
<tr>
<td><code>[RADIUS_FOR_HOME]</code></td>
<td>All location coordinates within this distance (meters) from the home location coordinates are considered a homestay (see <code>timeathome</code> feature).</td>
</tr>
</tbody>
</table>
<p>Features description for <code>[PHONE_LOCATIONS][PROVIDERS][DORYAB]</code>:</p>
<td>Not suggested for use now; see Observations below. “It encodes the extent to which a person’s location patterns follow a 24-hour circadian cycle." <ahref="../../citation#doryab-locations">Doryab et al.</a>.</td>
</tr>
<tr>
<td>numberofsignificantplaces</td>
<td>places</td>
<td>Number of significant locations visited. It is calculated using the DBSCAN/OPTICS clustering algorithm which takes in EPS and MIN_SAMPLES as parameters to identify clusters. Each cluster is a significant place.</td>
</tr>
<tr>
<td>numberlocationtransitions</td>
<td>transitions</td>
<td>Number of movements between any two clusters in a time segment.</td>
</tr>
<tr>
<td>radiusgyration</td>
<td>meters</td>
<td>Quantifies the area covered by a participant</td>
</tr>
<tr>
<td>timeattop1location</td>
<td>minutes</td>
<td>Time spent at the most significant location.</td>
</tr>
<tr>
<td>timeattop2location</td>
<td>minutes</td>
<td>Time spent at the 2<sup>nd</sup> most significant location.</td>
</tr>
<tr>
<td>timeattop3location</td>
<td>minutes</td>
<td>Time spent at the 3<sup>rd</sup> most significant location.</td>
</tr>
<tr>
<td>movingtostaticratio</td>
<td>-</td>
<td>Ratio between stationary time and total location sensed time. A lat/long coordinate pair is labeled as stationary if its speed (distance/time) to the next coordinate pair is less than 1km/hr. A higher value represents a more stationary routine. These times are computed using timeInSeconds feature.</td>
</tr>
<tr>
<td>outlierstimepercent</td>
<td>-</td>
<td>Ratio between the time spent in non-significant clusters divided by the time spent in all clusters (total location sensed time). A higher value represents more time spent in non-significant clusters. These times are computed using timeInSeconds feature.</td>
</tr>
<tr>
<td>maxlengthstayatclusters</td>
<td>minutes</td>
<td>Maximum time spent in a cluster (significant location).</td>
</tr>
<tr>
<td>minlengthstayatclusters</td>
<td>minutes</td>
<td>Minimum time spent in a cluster (significant location).</td>
</tr>
<tr>
<td>meanlengthstayatclusters</td>
<td>minutes</td>
<td>Average time spent in a cluster (significant location).</td>
</tr>
<tr>
<td>stdlengthstayatclusters</td>
<td>minutes</td>
<td>Standard deviation of time spent in a cluster (significant location).</td>
</tr>
<tr>
<td>locationentropy</td>
<td>nats</td>
<td>Shannon Entropy computed over the row count of each cluster (significant location), it is higher the more rows belong to a cluster (i.e., the more time a participant spent at a significant location).</td>
</tr>
<tr>
<td>normalizedlocationentropy</td>
<td>nats</td>
<td>Shannon Entropy computed over the row count of each cluster (significant location) divided by the number of clusters; it is higher the more rows belong to a cluster (i.e., the more time a participant spent at a significant location).</td>
</tr>
<tr>
<td>timeathome</td>
<td>minutes</td>
<td>Time spent at home (see Observations below for a description on how we compute home).</td>
Significant locations are determined using DBSCAN clustering on locations that a patient visit over the course of the period of data collection.</p>
<p><strong>Circadian Movement Calculation</strong>
Note Feb 3 2021. It seems the implementation of this feature is not correct; we suggest not to use this feature until a fix is in place. For a detailed description of how this should be calculated, see <ahref="https://pubmed.ncbi.nlm.nih.gov/28344895/">Saeb et al</a>.</p>
Based on an experiment where we collected fused location data for 7 days with a mean accuracy of 86 & SD of 350.874635, we determined that <code>EPS/MAX_EPS</code>=100 produced closer clustering results to reality. Higher values (>100) missed out on some significant places, like a short grocery visit, while lower values (<100) picked up traffic lights and stop signs while driving as significant locations. We recommend you set <code>EPS</code> based on your location data’s accuracy (the more accurate your data is, the lower you should be able to set EPS).</p>
<p><strong>Duration Calculation</strong>
To calculate the time duration component for our features, we compute the difference between consecutive rows’ timestamps to take into account sampling rate variability. If this time difference is larger than a threshold (300 seconds by default), we replace it with a maximum duration (60 seconds by default, i.e., we assume a participant spent at least 60 seconds in their last known location)</p>
<p><strong>Home location</strong>
Home is calculated using all location data of a participant between 12 am and 6 am, then applying a clustering algorithm (<code>DB_SCAN</code> or <code>OPTICS</code>) and considering the center of the biggest cluster home for that participant.</p>
</div>
<!-- Add custom comment system integration here -->
<!-- Utterances integration -->
<h2id="__comments">Comments</h2>
<scripttype="text/javascript">
var rapids_utterances_theme = false
document.onreadystatechange = function () {
if (document.readyState == "interactive") {
// wait for utterances to load and send it's first message.
addEventListener('message', event => {
if (event.origin !== 'https://utteranc.es' || rapids_utterances_theme == true) {
<scriptid="__config"type="application/json">{"base":"../..","features":["navigation.sections","search.suggest","search.highlight"],"translations":{"clipboard.copy":"Copy to clipboard","clipboard.copied":"Copied to clipboard","search.config.lang":"en","search.config.pipeline":"trimmer, stopWordFilter","search.config.separator":"[\\s\\-]+","search.placeholder":"Search","search.result.placeholder":"Type to start searching","search.result.none":"No matching documents","search.result.one":"1 matching document","search.result.other":"# matching documents","search.result.more.one":"1 more on this page","search.result.more.other":"# more on this page","search.result.term.missing":"Missing"},"search":"../../assets/javascripts/workers/search.df8cae7d.min.js","version":{"provider":"mike"}}</script>