Exposure to urban parks improves affect and reduces negativity on Twitter

Urbanization and the decline of access to nature have coincided with a rise of mental health problems. A growing body of research has demonstrated an association between nature contact and improved mental affect (i.e., mood). However, previous approaches have been unable to quantify the benefits of urban greenspace exposure and compare how different types of outdoor public spaces impact mood. Here, we use Twitter to investigate how mental affect varies before, during, and after visits to a large urban park system. We analyze the sentiment of tweets to estimate the magnitude and duration of the affect benefit of visiting parks. We find that affect is substantially higher during park visits and remains elevated for several hours following the visit. Visits to Regional Parks, which are greener and have greater vegetative cover, result in a greater increase in affect compared to Civic Plazas and Squares. Finally, we analyze the words in tweets around park visits to explore several theorized mechanisms linking nature exposure with mental and cognitive benefits. Negation words such as"no","not", and"don't"decrease in frequency during visits to urban parks. These results point to the most beneficial types of nature contact for mental health benefits and can be used by urban planners and public health officials to improve the well-being of growing urban populations.


Introduction
Urban parks have long been seen as a beneficial space for physical and psychological wellbeing.
Roughly 80% of Americans live in urban areas and average media consumption is approaching 11 hours daily (Nielsen, 2017;United Nations, 2014). A decline in both access to natural areas and in affinity towards nature are contributing to a trend of decreased nature contact (Soga & Gaston, 2016). With rapid urbanization occurring at a global scale, urban parks are the most accessible form of nature for the majority of people.
Declining nature contact has been paralleled by a rise in mental and behavioral disorders. An the act of spending intentional time in nature for mental restoration, has long been practiced for its health benefits in Japan; however, these therapies have only recently started to gain traction in Western Medicine (Wessel, 2017).
Complementary theories from psychology and neurobiology suggest mechanisms connecting nature exposure with improvements in mood (Berto, 2014;Frumkin et al., 2017). Stress Reduction Theory (SRT) predicts a decrease in physiological stress following nature contact, resulting in a variety of positive health outcomes (Ulrich et al., 1991; Ward Thompson, Aspinall, Roe, Robertson, & Miller, 2016). Attention Restoration Theory (ART) predicts that time in nature provides the opportunity to restore directed attention capacity, which results in improved cognition (Ohly et al., 2016). Nature exposure has also been found to correlate with increased prosocial behavior through 'unselfing', a shift away from self-interest and towards generosity (Zhang,   In the present study, we use Twitter to quantify the change in subjectively experienced feeling, or affect, from visiting urban parks. We use the Hedonometer, a word analysis tool that quantifies the sentiment of text, as an indicator for affect (Dodds et al., 2011;Dodds & Danforth, 2010). The Hedonometer has been used to estimate the happiness of cities and states (Mitchell, Frank, Harris, Dodds, & Danforth, 2013), describe the narrative arcs of books (Reagan, Mitchell, Kiley, Danforth, & Dodds, 2016), and analyze the discourse around climate change following hurricanes (Cody et al. 2015). This tool enables us to estimate the marginal change in affect (hereafter, "affect benefit") from visiting urban parks, which has been difficult to quantify in previous work (Barton & Pretty, 2010). We also investigate how park type and vegetation mediate the magnitude of the affect benefit from park visitation. Finally, we analyze word frequency patterns around park visitation to explore the mechanisms driving mental benefits from park visitation.

Research Questions
1) What is the magnitude and duration of the affect benefit from visiting urban parks?
2) How does park type and vegetative cover mediate the affect benefit from park visitation?
3) What do Twitter word use patterns indicate about the mechanisms driving the affect benefit from park visitation?

Study Site & Data Collection
Using Twitter's streaming Application Programming Interface

Fig. 1. San Francisco Recreation and Parks Facility Map.
We constructed a list of Twitter users who had visited at least one park during the study period and queried the Twitter API for their 3,200 most recent tweets. A month later, we updated user histories with any tweets posted since the park visit. We used several heuristics to remove automated bots and businesses from the user sample and additionally removed any individual who made their account private in the period following their park tweet. Our process resulted in 5,065 user timelines.

Tweet Binning
We saved the following fields for each tweet within a user's timeline: Message identification string, timestamp, text, language, and location. We used tweet timelines as the raw data for all further analysis. We define a park exposure as the first tweet posted from within a park on a given calendar day. We assigned all other tweets as "pre" or "post" to the closest park exposure tweet before or after, enabling the "binning" of tweets across users into hourly bins. For example, if a user tweeted in a park a 2PM, and also tweeted at 10:30 AM and 4:15 PM, the user would have tweets in the -4, 0 (in park), and +3 bins. We included subsequent in-park tweets on the same day following an initial exposure in the post-park bins at the appropriate relative hour.
By pooling users into relative time bins, we were able to create large enough word samples to apply sentiment analysis.

Sentiment Analysis
The Hedonometer applies a sentiment dictionary for 10,022 of the most commonly used English words, merged from four distinct text corpora. The Hedonometer performs favorably compared with other sentiment dictionaries, using a continuum scoring of words with high coverage (Reagan, Danforth, Tivnan, Williams, & Dodds, 2017). Word ratings were calculated by averaging scores from a pool of online crowdsource workers at Amazon's Mechanical Turk (Dodds et al., 2011). The words were rated on a scale from 1 (least happy) to 9 (most happy). For example, 'sunshine' has a score of 7.94 and 'traffic' has a score of 3.34. Words with scores between 4 and 6 are excluded from the analysis either because they are emotionally neutral (e.g., 'at' (4.9), 'and' (5.2)) or because they are context dependent (e.g. 'church' (5.5), 'capitalism' (5.2)). For our study, we also removed any words appearing in the names of San Francisco Parks from the analysis (e.g., 'golden' (7.3), 'gate' (5.1), and 'park' (7.1) are excluded).

Estimating Affect
For a group of tweets, we estimate affect as the weighted average of sentiment word scores using their relative frequencies as weights. We generate affect time curves by applying the Hedonometer to hourly bins of tweets before, during, and after park exposure. To provide additional statistical support to this approach, we use a bootstrapping procedure. For a given hourly bin, we randomly select 80% of the tweets (without replacement) and calculate the affect.
Performing this procedure 100 times, we derive a range of plausible mean affect values for each tweet bin.
To quantify the affect benefit from exposure to urban greenspace, we compare the affect from tweets before park visits with park exposure. First, we define a set of baseline tweets. For an individual park, these are tweets occurring more than 1 and up to 6 hours prior to tweets occurring in that park. We subtract the baseline affect from the affect of the park exposure tweets. To estimate a plausible interval for affect benefit, we perform a similar bootstrapping procedure. We select a random 80% of tweets from both the baseline and park tweets and calculate the difference in their affect scores. Performing this operation 100 times, we are able to estimate a mean, variance, and 95% Confidence Interval for the mean affect benefit. Robustness checks were performed to show convergence of this range at 100 samples.

Duration Calculation
To estimate the duration of benefits from visiting a park or set of parks, we define the baseline set of tweets in the same manner as above. We then perform the following bootstrapping procedure in an iterative manner. We start with the tweets occurring one hour after park exposure and estimate the affect difference between the baseline and that hourly bin of tweets. We continue to the next bin if the interval does not include zero. The affect benefit duration is the latest hourly bin at which the bootstrapped difference in affect does not include zero.

Park Classifications and NDVI
To understand how park type relates to the benefits of park exposure, we use the San Francisco

What are the magnitude and duration of the affect benefit from visiting urban parks?
Tweets posted within parks have a higher affect than tweets posted before or after park visits.
We depict the affect time curve for all users in Figure 2, with average affect fluctuating between roughly 6.1 and 6.2 outside of park visits. Affect reaches 6.42 across all tweets occurring in parks. Park exposure appears to induce an anticipatory and sustained increase in affect, as the immediate hours before and after park exposure also elevated from baseline. This may be due to tweets occurring near or within parks without a proper geotagged location. The bootstrapped intervals for mean affect are narrower around the park exposure because our dataset contains more tweets during those hours than in any individual hour preceding or following the park exposure.

Fig. 2. Affect before, during, and after park visit. Average affect for all user tweets (y-axis), within 24 hours of park exposure, binned by relative hour to in-park tweet (x-axis). The green vertical line represents the tweet in a San Francisco Park, with highest affect value. The blue range is the 95% Confidence Interval of mean affect for that hour bin based on 100 runs of randomly sampling 80% of tweets.
The mean affect benefit for all parks is 0.237 (0.227, 0.248) (Figure 3). As a point of reference, the average day on Twitter in 2016 had a sentiment of 6.04, and Christmas Day was the happiest day in 2016 with a sentiment of 6.26 (http://www.hedonometer.org). Thus, across our user pool, visiting an urban park had a similar affect benefit than did Christmas Day for Twitter as a whole.
Across all parks, we estimate the duration of elevated sentiment excluding tweets inside and within 1 hour of park visits. We find that affect remains elevated for six hours, compared to a baseline level averaged over 1 to 6 hours before park visitation. We estimated this by consecutively comparing the affect of each hour of tweets following park visits with the baseline group of tweets using the bootstrapping procedure.  Table 2).

What do Twitter word use patterns indicate about the mechanisms driving the affect benefit from park visitation?
Tweets in parks have higher affect than tweets prior to park visitation due to positive words with higher frequency, such as 'beach', 'beautiful', 'festival', 'happy', 'young', 'fun', and negative words with lower frequency, such as 'fee', 'not', 'no', 'don't', 'can't', and 'wait' (Figure 4). Of specific interest, negation words such as 'not' and 'don't' fluctuate before and after park exposure but exhibit a marked drop (45% and 47%) in and around the park exposure ( Figure 5A, 5B). The word 'beautiful' exhibits the opposite pattern, fluctuating around a baseline and then

Discussion
Many factors contribute to psychological well-being, and it has been challenging to quantify the relationship between exposure to greenspace and improvements in mental health. In this study, we quantified the affect benefit from visits to urban greenspace by thousands of individuals. In our sample, individuals tweet happier words while visiting parks, and continue to use happier words for several hours following their visit. Regional Parks, which are larger and greener, deliver greater happiness than the smaller and less vegetated Civic Plazas and Squares. Based on our word frequency analysis, improved affect from park visits appears to be driven by a decline in negative thinking. Our study deepens the evidence base for the mental health benefits provided by nature contact in urban areas. Specifically, it advances several recently identified research priorities for nature contact and human health (Frumkin et al., 2017). As we continue to uncover the mechanisms driving mental health benefits from nature, we can better inform public health policy and target park planning and design to maximize these benefits.
In our study, a dose of urban nature increased affect by roughly 0.24 points on the hedonometer scale. That affect benefit is equivalent to that of Christmas Day for Twitter as a whole in the same year (http://hedonometer.org). Our analysis of duration suggests that the affect benefit lasts for roughly 6 hours across all parks. The recent Urban Mind study found a similar duration for their weeklong study on roughly 100 users self-reporting their happiness in different environments (Bakolis et al., 2018). These impacts relate to single, acute exposures to nature.
We do not analyze the benefits of regular or multiple visits to urban parks; this is an important area of future research that can be explored using the techniques developed here.
While much remains to be investigated around how park characteristics relate to mental health benefits, this analysis offers an initial step in defining the types of parks that are most beneficial. Visits to Regional Parks and Neighborhood Parks and Playgrounds resulted in greater benefits than Civic Plazas and Squares. These two categories are more vegetated and thus may offer more opportunity for nature contact compared to Civic Plazas and Squares (Table 1). While we are unable to measure how much time is spent in a park following a tweet, it is plausible that individuals are spending more time proximate to nature during their visits to Regional Parks.
Alternatively, the size of Regional Parks may be providing greater restorative capacities through a greater removal from the urban environment with a greater variety of landscape types.
Neighborhood Parks and Playgrounds are smaller but more dispersed throughout the city ( Figure   1). Civic Plazas, which tend to be paved and more centrally located, represent a similarly outdoor, public gathering space where people go to socialize in their time away from work. Our results indicate that Regional and Neighborhood Parks are a more restorative space than Civic Plazas, and that nature per se is potentially playing a role in delivering mental benefits to park visitors.
The mechanisms through which urban nature exposure improves mental health are still being investigated. Green Mind Theory, a recent synthesis of proposed pathways, suggests that the negativity bias of the brain -which may have been evolutionarily advantageous -is constantly activated by the stressors of modern life (Pretty, Rogerson, & Barton, 2017). In our analysis, park visitation coincides with a decrease in words such as 'no', 'don't', and 'never' (Figure 4).
These words, known as negations, are associated with focused, analytical thinking (Pennebaker, links nature exposure with the experience of soft fascination and can result in improved cognition (Ohly et al., 2016). Alternatively, the increase in frequency of words such as 'beautiful', 'fun', and 'enjoy' during park exposure suggest that individuals may be experiencing an increase in positive emotions and a reduction in stress, as predicted by Stress Reduction Theory (Berto, 2014). While the words 'I' and 'me' do not have an impact on our analysis of affect due to their neutral sentiment values, there is a distinct decrease in use of these first-person pronouns during park exposure ( Figure 4D). This pattern supports previous work describing nature exposure as an opportunity to shift from an individual to collective mental frame, potentially leading to pro-social behavior (Zhang et al., 2014).
While this study has shown the value of acute exposures to urban nature for a large sample of people, many questions remain. Due to the difficulty of extracting this information from Twitter profiles, we were unable to look at how social class, age, gender, and education levels interact with changes in affect from park visitation. There is significant variation in how different groups and individuals experience and relate to nature; future work should attempt to understand how individual traits mediate the effects of visiting urban greenspace (Gascon et al., 2015). It is possible that our sample of Twitter users willing to geolocate may differ from the general population. In 2016, 24% of online adults were active Twitter users, albeit with a slight overrepresentation by younger Americans (Greenwood, Perrin, & Duggan, 2016). Furthermore, cultures in varied climates will likely demonstrate different relationships with nature exposureresponses to nature contact will likely manifest very differently in a tropical climate compared to San Francisco (Saw, Lim, & Carrasco, 2015). Future work should also attempt to further disentangle the roles of exercise and socialization from the direct contributions of nature to enhanced well-being (Ambrey, 2016). Technologies such as heart-rate monitors may provide new opportunities for separating the benefits of outdoor exercise from the benefits of nature exposure per se. In addition, moving beyond vegetative cover and assessing the roles of structural complexity, bodies of water, and biodiversity in parks will further our understanding of the most effective parks types for mental health (Hough, 2014).

Conclusions
Policymakers and urban planners must balance demands from a variety of stakeholders under tight budgets. Conserving natural spaces and protecting mental health can be seen as distinct goals competing for funding; however, research linking health with urban greenspace can help planners and public health officials build strategies that support both goals. These win-win scenarios can be achieved by building new parks near populations with limited access to greenspace or targeting funds toward the most effective types of parks for mental benefits.
Supporting these types of programs can result in positive feedback loops as people who use greenspaces tend to support further conservation efforts, increasing opportunities for others to access and enjoy nature.