# NOT RUN {
library(tidyverse)
library(tidyquant)
library(recipes)
library(timetk)
# Get missing values
FANG_wide <- FANG %>%
select(symbol, date, adjusted) %>%
pivot_wider(names_from = symbol, values_from = adjusted) %>%
pad_by_time()
FANG_wide
# Apply Imputation
recipe_box_cox <- recipe(~ ., data = FANG_wide) %>%
step_ts_impute(FB, AMZN, NFLX, GOOG, period = 252, lambda = "auto") %>%
prep()
recipe_box_cox %>% bake(FANG_wide)
# Lambda parameter used during imputation process
recipe_box_cox %>% tidy(1)
# }
Run the code above in your browser using DataLab