Technology Stocks Surge: Causal Impact of FTC Actions

[This article was first published on ©2020-2024 |, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Technology stocks have risen sharply from the second half of the previous year. Perhaps the rumors of the FED probable rate cuts affected that, but I want to look closer at it. I will examine this situation with a fund based mostly on NASDAQ-100 which is known heavily for technology stocks, and S&P Global 1200 Information Technology index.


#İş Asset Technology Mixed Fund (ITP)
df_itp <- read_csv("")

#Tibble object
df_itp_tbl <- 
  df_itp %>% 
  mutate(Date = parse_date(Date, "%m/%d/%Y")) %>% 
  janitor::clean_names() %>% 
  select(date, itp = price) %>% 

#Federal Funds Effective Rate
df_fedfunds <- 
  tq_get("FEDFUNDS", get = "") %>% 
  #Low to high frequency
  pad_by_time(date, .by = "day") %>% 
  tidyr::fill(price, .direction = "up") %>% 
  select(date, fedfunds = price) %>% 
  #adding days to match the df_itp
  mutate(date = date + days(57)) 

#Merging all the data sets
df_merged <- 
  df_itp_tbl %>% 

I’ve added the FED effective rates to my model to improve the accuracy. Now, I will construct a causal inference model using a Bayesian time series structure. I will do that with CausalImpact package.

To do that, I set an intervention that probably affected the response variable (fund price). On March 30, 2023, the Federal Trade Commission (FTC) took action against several companies that used AI to create and distribute misleading advertisements. I will use this date as a pre and post-treatment period.

#Zoo object for the CausalImpact function
df_merged_zoo <- with(df_merged, zoo(cbind(itp, fedfunds), date))

#The pre-period and the post-period data sets
pre.period <- as.Date(c("2021-04-07", "2023-03-30"))
post.period <- as.Date(c("2023-03-31", "2024-05-28"))

#Causal effect

impact <- CausalImpact(df_merged_zoo, 

#Summarized results

As seen in the above results, the relative effect shows that 66% increase which means the observed values are 66% higher than the counterfactual values which denotes how the response variable would have evolved if the intervention had never occurred. The result is significant because 95% confidence intervals(CI) exclude 0.

Finally, we will draw a plot showing the results we mentioned above.

#Plotting the effects

#Text box data frame for the plot
df_textbox <- data.frame(
  x = c(as.Date("2023-03-30"),
  y = c(5,3),
  label = c("Actions against deceptive AI marketing",
            "Actions against unfair credit scoring algorithms"),
  family = "Bricolage Grotesque"

plot(impact, c("original")) +
  geom_vline(xintercept = as.Date("2023-11-01"),
             linetype = "dashed",
             color = "#a9a9a9",
             linewidth = 0.8)+
  geom_textbox(data = df_textbox, 
               aes(x = x, 
                   y = y, 
                   label = label,
                   family = family),
               width = unit(1.2, "inch"))+
  labs(title = "Increment of +66% in the ITP due to the actions taken by the FTC") +
  theme(plot.title = ggtext::element_markdown(face = "bold", 
                                              hjust = 0.5,
                                              size = 15),
        text = element_text(family = "Bricolage Grotesque"))
To leave a comment for the author, please follow the link and comment on their blog: ©2020-2024 | offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)