In the cross_price_elasticity.R file, in the line with comment "keep sales of sku as target and price of all other skus as other variables", the code following is not excluding the sku in the current loop but instead includes all the skus rather than all other skus.
input = df_casted %>% # keep sales of sku as target and price of all other skus as other variables
select(str_subset(names(df_casted), 'average_price'), target_variable)
If own elasticity is needed, then comment should be corrected to reflect the logic.
In the cross_price_elasticity.R file, in the line with comment "keep sales of sku as target and price of all other skus as other variables", the code following is not excluding the sku in the current loop but instead includes all the skus rather than all other skus.
input = df_casted %>% # keep sales of sku as target and price of all other skus as other variables
select(str_subset(names(df_casted), 'average_price'), target_variable)
If own elasticity is needed, then comment should be corrected to reflect the logic.