The technology sector has experienced remarkable growth and volatility over the past decade. This analysis examines the stock price performance of eight prominent technology companies from 2016 to 2024, a period marked by significant market events including the COVID-19 pandemic, supply chain disruptions, and the AI revolution.
This study focuses on the following stocks:
The primary objectives of this analysis are to:
# Load required libraries
library(quantmod)
library(tidyverse)
library(knitr)
library(scales)
# Define stock symbols
stocks <- c("AAPL", "AMD", "MU", "NIO", "NVDA", "PRPL", "SNAP", "TSLA")
# Download stock data from 2016 to 2024
start_date <- "2016-01-01"
end_date <- "2024-12-31"
# Initialize empty dataframe
stock_data <- data.frame()
# Download data for each stock
for (stock in stocks) {
tryCatch({
data <- getSymbols(stock, src = "yahoo", from = start_date, to = end_date, auto.assign = FALSE)
df <- data.frame(
Date = index(data),
Price = as.numeric(Cl(data)),
Stock = stock
)
stock_data <- rbind(stock_data, df)
}, error = function(e) {
message(paste("Error downloading", stock))
})
}
# Create normalized data (base = 1)
df_norm <- stock_data %>%
group_by(Stock) %>%
mutate(Price = Price / first(Price)) %>%
ungroup()
The table below shows key statistics for each stock during the analysis period:
| Stock | Start Date | End Date | Starting Price | Ending Price | Min Price | Max Price | Total Return |
|---|---|---|---|---|---|---|---|
| AAPL | 2016-01-04 | 2024-12-30 | $26.34 | $252.20 | $22.58 | $259.02 | 857.6% |
| MU | 2016-01-04 | 2024-12-30 | $14.33 | $85.31 | $9.56 | $153.45 | 495.3% |
| AMD | 2016-01-04 | 2024-12-30 | $2.77 | $122.44 | $1.80 | $211.38 | 4 320.2% |
| TSLA | 2016-01-04 | 2024-12-30 | $14.89 | $417.41 | $9.58 | $479.86 | 2 702.5% |
| NVDA | 2016-01-04 | 2024-12-30 | $0.81 | $137.49 | $0.63 | $148.88 | 16 889.8% |
| PRPL | 2016-01-04 | 2024-12-30 | $9.66 | $0.83 | $0.56 | $40.05 | -91.4% |
| SNAP | 2017-03-02 | 2024-12-30 | $24.48 | $10.86 | $4.99 | $83.11 | -55.6% |
| NIO | 2018-09-12 | 2024-12-30 | $6.60 | $4.38 | $1.32 | $62.84 | -33.6% |
The following faceted plot displays the closing price trends for each stock over time, allowing us to observe individual patterns, growth trajectories, and volatility.
# Plot 1: Faceted individual stock prices
ggplot(stock_data, aes(Date, Price)) +
geom_line(color = "darkblue", size = 0.6) +
facet_wrap(~ Stock, scales = "free_y", ncol = 3) +
labs(y = "Closing prices", x = "Date",
title = "Individual Stock Price Trends (2016-2024)") +
theme_minimal() +
theme(
plot.title = element_text(hjust = 0.5, size = 14, face = "bold", margin = margin(b = 15)),
strip.background = element_rect(fill = "lightgray", color = NA),
strip.text = element_text(size = 11, face = "bold"),
panel.grid.minor = element_blank(),
panel.background = element_rect(fill = "gray95")
)
By normalizing all stock prices to a base value of 1 at the start of 2016, we can directly compare the relative performance and growth rates across all companies, regardless of their actual share prices.
# Plot 2: Normalized stock prices
p1 <- ggplot(df_norm, aes(Date, Price, color = Stock)) +
geom_line(size = 0.8) +
labs(title = "Normalized Stock Prices (2016-2024)",
y = "Normalized Price (Base = 1)",
x = "Date",
subtitle = "All stocks normalized to 1.0 at start of 2016 for performance comparison") +
theme_minimal() +
theme(
plot.title = element_text(hjust = 0.5, size = 16, face = "bold"),
plot.subtitle = element_text(hjust = 0.5, size = 11, color = "gray30", margin = margin(b = 15)),
legend.position = "right",
legend.title = element_text(face = "bold"),
panel.grid.minor = element_blank()
) +
scale_y_continuous(labels = comma)
# Display the plot
p1
| Stock | Final Normalized Price |
|---|---|
| NVDA | 169.90 |
| AMD | 44.20 |
| TSLA | 28.03 |
| AAPL | 9.58 |
| MU | 5.95 |
| NIO | 0.66 |
| SNAP | 0.44 |
| PRPL | 0.09 |
This analysis of eight technology stocks from 2016 to 2024 reveals several important insights:
NVIDIA’s Dominance: NVDA emerged as the top performer, driven by the AI boom and demand for advanced computing chips. The stock showed exponential growth, particularly after 2022.
Sector Divergence: Traditional tech giants like Apple demonstrated steady, reliable growth, while newer companies in EV and social media sectors exhibited higher volatility.
Market Cycles: The data captures multiple market cycles, including the COVID-19 crash and recovery, the 2021-2022 tech stock peak, and subsequent corrections.
Risk vs. Return: Higher growth stocks (NVDA, TSLA) came with significantly higher volatility, while established companies (AAPL) offered more stable returns.
The normalized comparison reveals that starting price is not indicative of growth potential. Companies trading at lower absolute prices can deliver substantial returns, while high-priced stocks can also multiply in value.
Diversification across different technology sub-sectors would have provided both growth opportunities and risk mitigation during this period.
Further analysis could include: