Previous laboratory research had shown that people who are in a good mood are willing to take riskier bets and that unexpected positive outcomes are particularly likely to boost people's mood.
But there was little research establishing a link between unexpected positive outcomes and actual risk taking behaviour in the real world.
Researchers from the New York University and University College London analysed two years' worth of daily lottery purchases in 174 New York City neighbourhoods.
To examine sports outcomes, researchers first tabulated all wins and losses in regular and postseason games played by New York City-area teams in 2011 and 2012, including teams in the National Football League, National Basketball League, National Hockey League, and Major League Baseball.
More From This Section
Using this data, they calculated a daily expectation of each team's win probability, which served as the prediction for the next day's sports outcomes.
On each day that a team played, the difference between the predicted outcome and the true outcome provided a measure of how unexpectedly good or bad the actual sports outcome was.
As with the sports data, the researchers calculated a weighted daily average for amount of sunshine that served as the prediction for the next day's sunshine.
To account for their potential effects on gambling, the researchers also included variables in their statistical model to represent the specific day of the week, holidays, typical paycheck cycles, and severe weather events.
They found that the more unexpected the sports teams' wins were, the more New York City residents spent on lottery purchases the next day. Similarly, the more unexpected sunshine there was, the more people gambled that day.
"These results reveal a remarkable malleability to human risk taking - people's gambling behaviour is shaped by unexpected, but incidental outcomes in their environment," said Ross Otto from New York University.
The findings were published in the journal Psychological Science.