EconBase
← Back to paper

Estimating Heterogeneous Consumer Preferences for Restaurants and Travel Time Using Mobile Location Data

Extracted main text — title through conclusion, appendix excluded. This is what our citation measures are computed over, published so the extraction can be checked by eye.

25,248 characters · 7 sections · 7 citation commands

Rendered from LaTeX for readability, not typeset faithfully. Citation keys are highlighted; maths is left as source; figures, tables and equation environments are summarised rather than reproduced; unrecognised commands are greyed out so nothing is silently dropped. Email addresses are removed.

Estimating Heterogeneous Consumer Preferences for Restaurants and Travel Time Using Mobile Location Data

\shortTitle{Consumer Preferences for Restaurants}

\pubMonth{May} \pubYear{2018} \pubVolume{Vol} \pubIssue{Issue}

abstractThis paper analyzes consumer choices over lunchtime restaurants using data from a sample of several thousand anonymous mobile phone users in the San Francisco Bay Area. The data is used to identify users’ approximate typical morning location, as well as their choices of lunchtime restaurants. We build a model where restaurants have latent characteristics (whose distribution may depend on restaurant observables, such as star ratings, food category, and price range), each user has preferences for these latent characteristics, and these preferences are heterogeneous across users. Similarly, each item has latent characteristics that describe users’ willingness to travel to the restaurant, and each user has individual-specific preferences for those latent characteristics. Thus, both users’ willingness to travel and their base utility for each restaurant vary across user-restaurant pairs. We use a Bayesian approach to estimation. To make the estimation computationally feasible, we rely on variational inference to approximate the posterior distribution, as well as stochastic gradient descent as a computational approach. Our model performs better than more standard competing models such as multinomial logit and nested logit models, in part due to the personalization of the estimates. We analyze how consumers re-allocate their demand after a restaurant closes to nearby restaurants versus more distant restaurants with similar characteristics, and we compare our predictions to actual outcomes. Finally, we show how the model can be used to analyze counterfactual questions such as what type of restaurant would attract the most consumers in a given location.

Where should a a new restaurant be located? What type of restaurant would be best in a given location? How close does a competitor need to be to matter? These are examples of questions about product design and product choice. While there is extensive literature on consumer response to prices, there is relatively little attention to firm choices about physical location and product characteristics. Recent trends in digitization have led to the creation of many large panel datasets of consumers, which in turn motivates the development of models that exploit the rich information in the data and provide precise answers to these questions.

Answering many of these questions requires a model that incorporates individual-level heterogeneity in preferences for product attributes and travel time, as these characteristics might vary substantially even within a city. More broadly, understanding individual heterogeneity in travel preferences is a key input for urban planning. To this end, we develop an empirical model of consumer choices over lunchtime restaurants, the Travel-Time Factorization Model (TTFM). TTFM incorporates rich heterogeneity in user preferences for both observed and unobserved restaurant characteristics as well as for travel time. We apply the model to a dataset derived from mobile phone locations for several thousand anonymized mobile phone users in the San Francisco Bay Area; this is the first structural model of individual travel choice based on mobile location data.

TTFM can answer counterfactual questions. For example, what would happen if a restaurant with a given set of characteristics opened or closed in a particular location? Using data about several hundred openings and closings of restaurants, we compare TTFM's predictions to the real outcomes. TTFM can also make personalized predictions for individuals and restaurants. Its personalized predictions are more accurate than existing methods, especially for high-activity individuals and popular restaurants.

TTFM incorporates recently developed approaches from machine learning for estimating models with a large number of latent variables. It uses a standard discrete choice framework to model each user's choice over restaurants, inferring the parameters of the users' utility functions from their choice behavior. TTFM differs from more traditional models in the number of latent variables; it incorporates a vector of latent characteristics for each restaurant as well as latent user preferences for these characteristics. In addition, it incorporates heterogeneous user preferences for travel distance, which vary by restaurant. These distance preferences are represented as the inner product of restaurant-specific factors and user willingness to travel to restaurants with those factors. Finally, TTFM is a hierarchical model, where observable restaurant characteristics affect the distribution of latent restaurant characteristics. We use a Bayesian approach to inference, where we estimate posterior distributions over each user's preferences and each restaurant's characteristics. The posterior is complex and the dataset is large. Thus, to make the estimation computationally feasible, we rely on stochastic variational inference to approximate the posterior distribution with a stochastic gradient optimization algorithm.

Our approach builds on a large literature in economics and marketing on estimating discrete choice models of consumer behavior; see keane2013panel for a survey. It also relates to a decades-old literature in marketing on inferring “product maps” from panel data elrod1988choice. Our estimation strategy is drawn from approaches developed in athey2017counterfactual and ruiz2017shopper, both of which considered the problem of choosing items from a supermarket, and it also relates to Wan2017, who take a matrix factorization approach to consumer choice. Though less well-studied, there has also been some work on estimating consumer preferences for travel time, e.g., neilsontargeted's study of school choice.

Empirical Model and Estimation

We model the consumer's choice of restaurant conditional on deciding to go out to lunch. We assume that the consumer selects the restaurant that maximizes utility, where the utility of user $u$ for restaurant $i$ on her $t$-th visit is \[U_{uit} = \lambda_i + \theta_u^\top \alpha_i + \mu_i^\top \delta_{w_{ut}} - \gamma_u^\top \beta_i \cdot \text{log}(d_{ui}) + \epsilon_{uit}, \] where $w_{ut}$ denotes the week in which trip $t$ happens, and $d_{ui}$ is the distance from $u$ to $i$. This gives a parameterized expression for the utility: $\lambda_i$ is an intercept term that captures a restaurant's popularity; $\theta_u$ and $\alpha_i$ are latent vectors that model a user's latent preferences and a restaurant's latent attributes; $\beta_i$ is a vector that captures a restaurant's latent factors for travel distance and $\gamma_u$ is a user's latent preferences of willingness to travel to restaurants with those factors; $\delta_w$ and $\mu_i$ are latent vectors of week/restaurant time effects (this allows us to capture varying effects for different parts of the year); and $\epsilon_{uit}$ are error terms, which we assume to be independent and identically Gumbel distributed. We specify a hierarchical model where observable characteristics of restaurants, denoted by $x_i$, affect the mean of the distribution of latent restaurant characteristics $\alpha_i$ and $\beta_i$. This hierarchy allows restaurants to share statistical strength, which helps to infer the latent variables of low-frequency restaurants. We estimate the posterior over the latent model parameters using variational inference. Our approach is similar to ruiz2017shopper, but differs in a few respects. First, we assume that each consumer chooses only one restaurant on a purchase occasion, so interactions among products are not important. Second, TTFM is hierarchical, allowing observed restaurant characteristics to affect the prior distribution of latent variables. (See Appendix (ref) for details.)

For comparison, we also consider a simpler model, a standard multinomial logit model (MNL), which is a restricted version of our proposed model: the term $\lambda_i$ is constant across restaurants, $\alpha_i$ is set to be equal to the observable characteristics of items, $\theta_u$ is constant across users, $\delta_w$ is omitted (including it created problems with convergence of the estimation), and $\gamma_u \cdot \beta_i$ is restricted to be constant across users and restaurants.

The Data and Summary Statistics

The dataset is from SafeGraph, a company that collects anonymous, aggregates locational information from consumers who have opted into sharing their location through mobile applications. The data consists of “pings” from consumer phones; each observation includes a unique device identifier that we associate with a single anonymous consumer, the time and date of the ping, and the latitude, longitude and accuracy of the ping over a sample period from January through October 2017.

From this data, we construct the key variables for our analysis. First, we construct the approximate “typical” morning location of the consumer, defined as the most common place the consumer is found from 9:00 to 11:15 a.m.\ on weekdays. We restrict attention to consumers whose morning locations are consistent over the sample period, and for which these locations are in the Peninsula of the San Francisco Bay Area (roughly, South San Francisco to San Jos\'{e}, excluding the mountains and coast). We determine that the consumer visited a restaurant for lunch if we observed at least two pings more than 3 minutes apart during the hours of 11:30 a.m.\ to 1:30 p.m.\ in a location that we identify as a restaurant. Restaurants are identified using data from Yelp that includes geo-coordinates, star ratings, price range, restaurant categories (e.g., Pizza or Chinese), and we also use Yelp to infer approximate dates of restaurant openings and closings. Last, we narrow the dataset to consumer choices over a subset of restaurants that appear sufficiently often in the data, and to consumers who visit a sufficient number of restaurants. This process results in a final dataset of 106,889 lunch visits by 9,188 users to 4,924 locations. Table (ref) provides summary statistics on the users and restaurants included in the dataset. (Appendix (ref) gives all details about the dataset processing pipeline.)

table[table omitted — 64 chars of source]

\afterpage

Estimation and Model Fit

We divide the dataset into three parts, 70.6 percent training, 5.0 percent validation, and 24.4 percent testing. We use the validation dataset to select parameters such as the length of the latent vectors $\alpha_i$ and $\beta_i$ ($k_1$ and $k_2$, respectively), while we compare models and evaluate performance in the test dataset. (See Section (ref) for details.) We select $k_1 = 80$ and $k_2 = 16$. In the hierarchical prior, the distribution of a restaurant's components depends on price range, star ratings, and restaurant category.

Across several measures evaluated on the test set, TTFM is a better model than MNL. For example, precision@5 is the percentage of times that a user's chosen restaurant is in the set of the top five predicted restaurants. It is 35% for TFMM and 11% for MNL. Further, as shown in Figures (ref) and (ref), TTFM predictions improve significantly for high-frequency users and restaurants, while MNL does not exhibit that improvement. This highlights the benefits of personalization: When given enough data, TTFM learns user-specific preferences.

table[table omitted — 258 chars of source]

\afterpage Figure (ref) illustrates that both TTFM and MNL fit well the empirical probability of visiting restaurants at varying distances from the consumer's morning location. But Figure (ref) shows that TTFM outperforms MNL at fitting the actual visit rates of different restaurants; here restaurants are grouped by their visit-frequency deciles. The rich heterogeneity of TTFM allows personalized predictions for restaurants.

figure[figure omitted — 454 chars of source]

\afterpage

Parameter Estimates

The distributions of estimated elasticities from TTFM are summarized in Table (ref) and Figure (ref). Note that the elasticities in the MNL vary only because the baseline visit probabilities vary across consumers and restaurants. TTFM elasticities are more dispersed, reflecting the personalization capabilities of the TTFM model. The average elasticity across consumers and restaurants (weighted by trip frequency) is $-1.41$. Thus, distance matters substantially for lunch, which is consistent with the fact that roughly 60 percent of visits are within two miles of the consumer's morning location. Furthermore, there is substantial heterogeneity in that willingness to travel. Across users and restaurants, the standard deviation of elasticities in the TTFM model is 0.68, while the average within-user standard deviation of elasticities is 0.30 and the average within-restaurant standard deviation of elasticities is 0.60. Elasticities are substantially less dispersed in the MNL model.

table[table omitted — 136 chars of source]
table[table omitted — 114 chars of source]
figure[figure omitted — 203 chars of source]

\afterpage Tables (ref) and (ref) and Figure (ref) illustrate how elasticities vary across restaurant types and cities. Willingness to travel is lower for low-priced restaurants (elasticity $-1.45$ for price range \$ (under \$10) versus $-1.37$ for price range \$\$ (\$11$-$\$30)); lower for Mexican restaurants and Pizza places than for Chinese and Japanese restaurants (elasticities of $-1.50$ and $-1.50$ versus $-1.35$ and $-1.32$, respectively). Cities with many work locations nearby retail districts, including San Jos\'{e}, Sunnyvale, and Mountain View have a lower willingness to travel than cities that are more spread out like Daly City, Burlingame, San Bruno, and San Mateo. Appendix Section (ref) provides further descriptive statistics about latent factors and model results, illustrating for example how to model can be used to find restaurants that are intrinsically similar (without regard to location) as well as which restaurants are similar in terms of user utilities.

Analyzing Restaurant Opening and Closing

The TTFM model can make predictions about how market share will be redistributed among restaurants when restaurants open or close, and these predictions can be compared to the actual changes that occur in practice. For this exercise, we focus on 221 openings and 190 closings where, both before and after the change, there were at least 500 restaurant visits by users with morning locations within a 3 mile radius of the relevant restaurant. Figure (ref) illustrates that restaurant openings and closings are fairly evenly distributed over the time period.

One challenge of analyzing market share redistribution is that for any given target restaurant that opens or closes, we would expect some baseline level of market share changes of competing restaurants due to changes in the open status of neighboring restaurants. We address this in an initial exercise where we hold the environment fixed in the following way. For each target restaurant that changed status, we first construct the predicted difference in market shares for each other restaurant between the “closed” and “open” regime (irrespective of which came first in time), and then subtract out the predicted change in market share that would have occurred for each restaurant if the target restaurant had been closed in both periods. We then sum the changes across restaurants in different groups defined by their distance from the target restaurant. Table (ref) shows TTFM model predictions for how the opening/closing restaurant's market share is redistributed over other restaurants within certain distances after the restaurant becomes unavailable (i.e. before the opening or after the closing). The TTFM model estimates imply that just over 50 percent of the market share impact of a closure accrues restaurants within 2 miles of the target restaurant.

table[table omitted — 148 chars of source]

Figure (ref) compares the actual changes in market share that occured against the predictions of the TTFM model. It should be noted that baseline changes unrelated to the opening and closing of the target restaurants seem to dominate both the actual and predicted market share changes in the figure. The figure shows that our model's predictions match well the actual changes that occurred, but it there is substantial variation in the changes that occured in the actual data, making it difficult to evaluate model performance using this exercise.

figure[figure omitted — 1,254 chars of source]

Our final exercise considers the best choice of restaurant type for a location. For the set of restaurants that open or close, we look at how the demand for the restaurant that changed status (the “target restaurant”) compares to the counterfactual demand the model predicts in the scenario where a different restaurant in our sample (as described by its mean latent characteristics) is placed in the location of the target restaurant. For each target, we consider a set of 200 alternative restaurants, 100 from the same category as the target restaurant and 100 from a different category. \footnote{These alternatives are sampled with equal probabilities from the set of restaurants in our sample.} We then compare the target restaurant's estimated market share to the mean demand across the set of alternatives. In Table (ref), we see that both the restaurants that opened and those that closed on average have higher predicted demand than either group of alternatives. However, the restaurants that opened appear to be in more valuable locations, since for the 200 alternative restaurants, we predict higher average demand if they were (counterfactually) placed at the opening locations than at the locations of closing restaurants. As a further comparison, we split the set of alternatives into groups based on whether or not they are in the same broad category as the restaurant that opened or closed. We find that alternative restaurants from the same category as the target would perform better on average than alternatives from a different category.

table[table omitted — 114 chars of source]

Ideal Locations and Ideal Restaurant Types

In this section, we consider the match between restaurant characteristics and locations. In each geohash6, we select one restaurant location at random and use the TTFM model to predict what the total demand would have been if a different restaurant had been located in its place. The set of alternative restaurants was chosen to include one restaurant from each of the major categories in the sample.\footnote{From each category, we randomly selected one restaurant whose market share is within $0.1$ standard deviation of the mean market share in the full sample.}

In Figure (ref), we examine which locations are predicted to provide the largest demand in the lunch market for each restaurant category. We can see for example that Vietnamese restaurants are predicted to have the highest demand in a dense region in the southeastern portion of the map. The demand for Filipino restaurants is relatively diffuse, whereas the demand for sandwiches is characterized by small but dense pockets of relatively high demand.

In Figure (ref), we group the restaurant categories into coarse groups based on the price range and the type of cuisine. We examine within each group which category would have the highest total demand in each location. There is considerable spatial heterogeneity in which restaurant category is predicted to perform best in each location.

Conclusions

This paper makes use of a novel dataset to analyze consumer choice: mobile location data. We propose the TTFM model, a rich model that allows heterogeneity in user preferences for restaurant characteristics as well as for travel time, where preferences for travel time vary across restaurants as well. We show that this model fits the data substantially better than traditional alternatives, and by incorporating recent advances in Bayesian inference, the estimation becomes tractable. We use the model to conduct counterfactual analysis about the impact of restaurants opening and closing, as well as to evaluate how the choice of restaurant characteristics affects market share. More broadly, we believe that with the advent of digitization, panel datasets about consumer location can be combined with rich structural models to answer questions about firm strategy as well as urban policy, and models such as TTFM can be used to accomplish these goals.