DiscoverR-bloggersGlobal Modeling with GluonTS DeepAR: Future of Semiconductors in the U.S.
Global Modeling with GluonTS DeepAR: Future of Semiconductors in the U.S.

Global Modeling with GluonTS DeepAR: Future of Semiconductors in the U.S.

Update: 2025-08-17
Share

Description




[This article was first published on DataGeeek, 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.


Bernstein has conducted an analysis of the U.S. supply and demand balance in analog and discrete semiconductors, particularly in light of the potential introduction of Section 232 tariffs. The analysis focuses on the implications for major companies, including Texas Instruments, Analog Devices, Infineon Technologies and Renesas.





According to analysts led by David Dai, if the U.S. successfully brings more manufacturing of end applications back onshore, demand for these products may rise even further. However, currently, there isn’t a significant gap that would lead to a substantial increase in the capacity for analog and discrete manufacturing in the U.S.





Infineon and Renesas have the greatest risk of exposure to potential tariffs due to their relatively small production footprint in the U.S., while Texas Instruments and Analog Devices, being U.S.-based, appear to be well-positioned.





The chart below indicates that all the aforementioned stock prices are under the point forecast line of the DeepAR model, but they have potential room to rise if they adapt to the supply chain shifts.





<figure data-wp-context="{"imageId":"68a1ae0884b23"}" data-wp-interactive="core/image" class="wp-block-image size-large wp-lightbox-container"><button
class="lightbox-trigger"
type="button"
aria-haspopup="dialog"
aria-label="Enlarge"
data-wp-init="callbacks.initTriggerButton"
data-wp-on-async--click="actions.showLightbox"
data-wp-style--right="state.imageButtonRight"
data-wp-style--top="state.imageButtonTop"
>
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="none" viewBox="0 0 12 12">
<path fill="#fff" d="M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z" />
</svg>
</button></figure>



Source code:





library(tidyverse)
library(tidymodels)
library(tidyquant)
library(timetk)
library(modeltime)
library(modeltime.gluonts)

#Texas Instruments Incorporated (TXN)
df_txn <-
tq_get("TXN") %>%
select(date, 'Texas Instruments' = close)

#Analog Devices, Inc. (ADI)
df_adi <-
tq_get("ADI") %>%
select(date, 'Analog Devices' = close)

#Infineon Technologies AG (IFNNY)
df_ifnny <-
tq_get("IFNNY") %>%
select(date, Infineon = close )

#Renesas Electronics Corporation (6723.T)
df_renesas <-
tq_get("6723.T") %>%
select(date, Renesas = close)


#Merging the datsets
df_merged <-
df_txn %>%
left_join(df_adi) %>%
left_join(df_ifnny) %>%
left_join(df_renesas) %>%
drop_na() %>%
filter(date >= last(date) - months(12)) %>%
pivot_longer(-date,
names_to = "id",
values_to = "value") %>%
mutate(id = as_factor(id))



#Split Data
split <- time_series_split(df_merged,
assess = "15 days",
cumulative = TRUE)



df_train <- training(split)
df_test <- testing(split)


#Fit a GluonTS DeepAR Model
model_fit_deepar <- deep_ar(
id = "id",
freq = "D",
prediction_length = 11,
lookback_length = 22,
epochs = 10
) %>%
set_engine("gluonts_deepar") %>%
fit(value ~ ., df_train)

#Modeltime Table
model_tbl <-
modeltime_table(
model_fit_deepar
)


#Calibrate by ID
calib_tbl <-
model_tbl %>%
modeltime_calibrate(
new_data = df_test,
id = "id"
)

#Measure Test Accuracy

#Global Accuracy
calib_tbl %>%
modeltime_accuracy(acc_by_id = FALSE) %>%
table_modeltime_accuracy(.interactive = FALSE)

#Local Accuracy
calib_tbl %>%
modeltime_accuracy(acc_by_id = TRUE) %>%
table_modeltime_accuracy(.interactive = TRUE)

#Prediction Intervals
calib_tbl %>%
modeltime_forecast(
new_data = df_test,
actual_data = df_merged %>% filter(date >= as.Date("2025-07-31")),
conf_by_id = TRUE
) %>%
group_by(id) %>%
plot_modeltime_forecast(
.facet_ncol = 2,
.interactive = FALSE,
.line_size = 1
) +
labs(title = "Global Modeling with Deep Learning Model",
subtitle = "Predictive Intervals of DeepAR Model Model",
y = "", x = "") +
scale_y_continuous(labels = scales::label_currency()) +
scale_x_date(labels = scales::label_date("%b %d"),
date_breaks = "3 days") +
theme_tq(base_family = "Roboto Slab", base_size = 16) +
theme(plot.subtitle = ggtext::element_markdown(face = "bold"),
plot.title = element_text(face = "bold"),
plot.background = element_rect(fill = "snow"),
strip.text = element_text(face = "bold", color = "black"),
strip.background = element_rect(fill = "azure"),
axis.text.x = element_text(angle = 45, hjust = 1, vjust = 1),
legend.position = "none")


To leave a comment for the author, please follow the link and comment on their blog: DataGeeek.



R-bloggers.com 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.
Continue reading: Global Modeling with GluonTS DeepAR: Future of Semiconductors in the U.S.
Comments 
00:00
00:00
x

0.5x

0.8x

1.0x

1.25x

1.5x

2.0x

3.0x

Sleep Timer

Off

End of Episode

5 Minutes

10 Minutes

15 Minutes

30 Minutes

45 Minutes

60 Minutes

120 Minutes

Global Modeling with GluonTS DeepAR: Future of Semiconductors in the U.S.

Global Modeling with GluonTS DeepAR: Future of Semiconductors in the U.S.

Selcuk Disci