I am thinking this my question is related to an earlier bug here. If so, I am just looking for some kind of work around.
I am getting the following error:
Error in new_CppObject_xp(fields$.module, fields$.pointer, …) :
Exception: mismatch in number dimensions declared and found in context; processing stage=data initialization; variable name=Y; dims declared=(92); dims found=(92,1) (in ‘model4234235eadc_model’ at line 16)
The stan code is on my github here. A csv of the data is here
Also, below is the R
code I use to prepare the data for Stan,
clean_data <- read_csv("clean_data.csv")
media_data <- clean_data %>% select(contains("m_"))
# data Prep
N <- nrow(clean_data)
Y <- clean_data[,"sales"] %>% as.vector()
max_lag <- 13
num_media <- 3
lag_vec <- seq(0, max_lag - 1)
X_media <- array(data = media_data, dim = 3)
num_ctrl <- 1
X_ctrl <- clean_data %>% select(price) %>% as.matrix()
stan_data <- list(N=N, Y=Y, max_lag=max_lag, num_media=num_media,
lag_vec=lag_vec,X_media=X_media,
num_ctrl=num_ctrl,X_ctrl=X_ctrl)