Chief Twit

A causal look at how Musk’s twitter ownership has affected Tesla stock

Umm… twitter is a weird place right now. Since Elon Musk’s $44 billion deal to take over twitter closed in late October, there have been mass layoffs, a floodgate of advertisers leaving the platform, and a near-daily deluge of disasters (for in depth coverage, I recommend visiting Platformer). It feels like the ship is going down, but it’s been pretty funny to watch everything unfold.

Folks who are invested in Tesla may find the situation somewhat less humorous — Tesla’s stock price has dropped 18% over the past month. That’s a lot to lose, but can it really be causally linked to Musk’s antics on twitter?

As it turns out, yes, it can. Following the approach taken by Alex Hayes and Fabian Dablander, we can use the {CausalImpact} package to compare Tesla’s stock price pre/post Musk’s takeover of twitter, using the S&P500 as a synthetic control.

library(tidyverse)
library(riingo)
library(CausalImpact)

# pull in stock from tiingo
stonks <- 
  bind_rows(
    riingo_prices("TSLA"), 
    riingo_prices("SPY")
  )

# adjust for tesla 3-1 stock split in aug
stonks <- 
  stonks %>%
  select(ticker, date, close) %>%
  mutate(close = if_else(date < lubridate::mdy("8/25/22") & ticker == "TSLA",
                         close/3,
                         close))

Looking at the two tickers side by side, Tesla seems to follow the index’s movement until the takeover.

stonks %>% 
  mutate(date = lubridate::as_date(date)) %>%
  ggplot(aes(x = date,
             y = close,
             color = ticker)) + 
  geom_line(linewidth = 1) + 
  scale_color_brewer(palette = "Dark2") + 
  facet_wrap(~ticker, 
             scales = "free_y",
             ncol = 1) +
  geom_vline(xintercept = lubridate::mdy("10/27/22"),
             linetype = "dashed") +
  scale_x_date(labels = scales::label_date(format = "%b")) +
  scale_y_continuous(labels = scales::dollar_format()) +
  theme(legend.position = "none") +
  labs(title = "STONKS: Tesla's and S&P500's daily close over the past year",
       x = NULL,
       y = NULL,
       caption = "Data from Dec 16, '21 -- Dec 16, '22")

Plugging this in blindly to CausalImpact() shows that Musk’s twitter antics have had an effect on Tesla’s price.

stonks <- 
  stonks %>%
  pivot_wider(names_from = ticker,
              values_from = close)

fit <- 
  CausalImpact(
    zoo(cbind(stonks$TSLA, stonks$SPY), stonks$date), 
    stonks$date[c(1, 217)],  # 12/16/21 - 10/26/22
    stonks$date[c(218, 253)] # 10/27/22 - 12/16/22
  )

fit %>% plot()

Prior to Musk’s twitter takeover, Tesla’s shares could be reliably estimated by the S&P500. After the takeover, however, Tesla’s share price has fallen outside of what the model would expect based on S&P500 data. The implied cost to Tesla shareholders is about $77 per share on average, though the credible interval could put the true cost anywhere between $17 and $133 per share.

This makes pretty strong assumptions — that Musk’s antics don’t affect S&P500 prices and that no other event is influencing Tesla’s price but not the S&P500 price. There’s lot’s more worth digging into in the paper (Brodersen, 2015) that {CausalImpact} accompanies. Since this was mostly a quick exploration on a Friday afternoon, however, I’ll leave the additional investigating to the reader. For me, it’s back to watching the site crash and burn.

Avatar
Mark Rieke
Senior CX Analyst

I’m a mechanical engineer by education, data analyst by practice. I love machine learning and communicating complex topics clearly with simple and beautiful charts.