My project will be using Google trends data for the search term Man City over a period of 20 years (2004-Present time). Google trends provides data for relative search interest, to examine how much public attention has changed. The aim of this project is to view patterns in the data, such as long term trends, short term fluctuations and seasonal effects. We will be using Meta’s Prophet forecasting model to predict future search interest over time. This project will give us an idea how interest in Man City has developed over time.
The dataset is imported from csv file and then transformed into a suitable format for modelling. The columns are renamed to ds and y. ds represents the date and y represents search interest. The functions head, tail and glimpse are used to examine the data’s characteristics and structure.
google_trends <- google_trends_raw %>%
rename(ds = Time, y = `Man city`) %>%
mutate(ds = as.Date(ds, format = "%d/%m/%Y"))
glimpse(google_trends)## Rows: 267
## Columns: 2
## $ ds <date> 2004-01-01, 2004-02-01, 2004-03-01, 2004-04-01, 2004-05-01, 2004-0…
## $ y <dbl> 3, 3, 4, 3, 2, 2, 2, 2, 3, 3, 3, 3, 4, 3, 3, 3, 3, 2, 3, 4, 3, 3, 3…
## # A tibble: 6 × 2
## ds y
## <date> <dbl>
## 1 2004-01-01 3
## 2 2004-02-01 3
## 3 2004-03-01 4
## 4 2004-04-01 3
## 5 2004-05-01 2
## 6 2004-06-01 2
## # A tibble: 6 × 2
## ds y
## <date> <dbl>
## 1 2025-10-01 29
## 2 2025-11-01 45
## 3 2025-12-01 46
## 4 2026-01-01 64
## 5 2026-02-01 61
## 6 2026-03-01 67
## ds y
## Min. :2004-01-01 Min. : 2.00
## 1st Qu.:2009-07-16 1st Qu.: 6.00
## Median :2015-02-01 Median : 16.00
## Mean :2015-01-30 Mean : 23.03
## 3rd Qu.:2020-08-16 3rd Qu.: 35.00
## Max. :2026-03-01 Max. :100.00
The graph displays interest in Man City searches over time on Google trends. From 2004 till the present, search interests have clearly increased, showing an increase in popularity. There are also regular fluctuations in the data with strong spikes. The spikes are highly likely due to major football events (such as the Champions League), crucial games and trophy victories. There also seems to be a seasonal pattern with recurring peaks happening over time at roughly same monthly periods likely due to the football schedule season. Recent years from 2015 onwards are showing increase in data fluctuations indicating a boost in interest.
ggplot(google_trends, aes(x = ds, y = y)) +
geom_line() +
labs(
title = "Google Trends for 'Man city'",
x = "Date",
y = "Search interest"
)
# Section 4 This adds the trend line.The trend line shows a clear upward
slope indicating that search interest for Man city has increased over a
period of time. Its showing long term growth despite short-term
variability. Which overall tells us that Man City has Increased in
popularity over time.
ggplot(google_trends, aes(x = ds, y = y)) +
geom_line() +
geom_smooth(method = "lm", se = FALSE) +
labs(
title = "Google Trends for 'Man city' with linear trend",
x = "Date",
y = "Search interest"
)## `geom_smooth()` using formula = 'y ~ x'
In this section, future google trends search interest for Man City is predicted using the Prophet model. The model produces forecasts with lower and higher confidence intervals for the upcoming 12 months. According to predicted values (yhat), search interest is anticipated to stay high throughout the projection period. falling between the range of around 45-65. The overall level of interest seems stable despite the slight fluctuations occuring.The prediction levels (yhat_lower and yhat_upper) show a degree of uncertainty in the forecasts, with a with a wider range indicating less certainty further into the future. Overall the model predicts that interest in Man city will be high.
## Disabling weekly seasonality. Run prophet with weekly.seasonality=TRUE to override this.
## Disabling daily seasonality. Run prophet with daily.seasonality=TRUE to override this.
future_dates <- make_future_dataframe(prophet_model, periods = 12, freq = "month")
tail(future_dates)## ds
## 274 2026-10-01
## 275 2026-11-01
## 276 2026-12-01
## 277 2027-01-01
## 278 2027-02-01
## 279 2027-03-01
forecast_values <- predict(prophet_model, future_dates)
forecast_values %>%
select(ds, yhat, yhat_lower, yhat_upper) %>%
tail(12)## ds yhat yhat_lower yhat_upper
## 268 2026-04-01 66.27711 52.31217 81.46325
## 269 2026-05-01 60.61192 46.22506 74.06798
## 270 2026-06-01 45.68583 31.24703 60.15048
## 271 2026-07-01 46.75369 32.73713 61.74228
## 272 2026-08-01 59.16908 44.59359 73.49917
## 273 2026-09-01 53.89783 39.07304 68.40795
## 274 2026-10-01 53.79262 38.57363 67.53779
## 275 2026-11-01 53.29443 37.86536 66.98261
## 276 2026-12-01 59.23254 45.00249 74.49361
## 277 2027-01-01 61.12257 46.44931 74.68563
## 278 2027-02-01 63.36776 48.59542 77.76486
## 279 2027-03-01 56.26973 40.91464 69.63479
The forecast plot shows both historical data and predicted future values along with uncertainty intervals. The trend component shows a clear upward pattern over time, indicating a long-term increase in search interest for Man City. The seasonal component tells us that there are recurring patterns within each year, suggesting that search interest depends on the time of year, which is likely due to the football schedule season and other major events outside of football.
## Warning: `aes_string()` was deprecated in ggplot2 3.0.0.
## ℹ Please use tidy evaluation idioms with `aes()`.
## ℹ See also `vignette("ggplot2-in-packages")` for more information.
## ℹ The deprecated feature was likely used in the prophet package.
## Please report the issue at <https://github.com/facebook/prophet/issues>.
## This warning is displayed once per session.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
#Section 7 Conclusion This project analysed Google trends data for
search interest in Man City, to understand how much the search interest
has changed over time. The data analysis shows a clear upward trend,
indicating increase in popularity, some fluctuations and seasonal
patterns linked to football events that occur within the football season
as well as outside the football season. The linear trend model confirmed
the overall growth in search interest for Man city, while the Prophet
forecasting model provided further insight by capturing both long-term
trends and seasonal variation. From what I can see, the overall
forecasts suggest that search interest will remain to be relatively high
with continued fluctuations. Overall, the results has shown that Man
City has surged in global interest and that time series forecasting is
very useful tool for predicting such patterns.