Following the post here, I came with another issue that is related to another topic. I am using PCA to use K number of principal components as exogenous regressors to use in an auto.arima model in R. These principal components are input in the parameter "xreg." The main problem I am having now is that the number of variables is larger than the number of observations of the data I am trying to fit. So when I choose, say 5 PCA, the number of rows is bigger than the number of observations in auto.arima and an error appears as:
Error in model.frame.default(formula = x ~ xreg, drop.unused.levels = TRUE) :
variable lengths differ (found for 'xreg')
In addition: Warning message:
In !is.na(x) & !is.na(rowSums(xreg)) :
longer object length is not a multiple of shorter object length
One way of solving this problem is to choose the number of rows with higher absolute values, so that they match the number of observations in the auto.arima. What do you think?