Predict time series data from another Here is my problem:
I have two times series which are highly correlated. One of my time series have one more data point. I would like to predict the other time series missing data.
For example (in R):
a = c(126,140,178,223,208,266)
b = c(155,154,220,277,256,334,330)

length(a) < length(b)

cor(a,b[1:6])

names(a) = seq(2000,2005,1)
names(b) = seq(2000,2006,1)

1. My very basic solution is just copy the change of b when I predict a, like this:
ch = (b[7] / b[6]) - 1
a[7] = a[6] + (a[6]*ch)

2. A little bit more complicated version but still basic is this (to predict a from b):
a = c(126,140,178,223,208,266)
b = c(155,154,220,277,256,334,330)

2.1. Give a same "scale" of it (same as plotting a and b to a 1 graph at the same time):
pred = c(NA)

for (i in 1:length(b))
{
pred[i] = ( b[i] / max(b) ) * max(a)
}

2.2 make a custom CI:

mistake = c(NA)

for (i in 1:(length(pred)-1))
{
mistake[i] = (pred[i] / a[i]) -1 
}

sd_mis = sd(mistake)

CI_l = c(NA)
CI_U = c(NA)

for (i in 1:length(pred))
{
CI_l[i] = pred[i] - (pred[i] * sd_mis)
CI_U[i] = pred[i] + (pred[i] * sd_mis)
}

pred = round(pred,0)
CI_l = round(CI_l,0)
CI_U = round(CI_U,0)

2.2 plotting:
plot(pred, type='o', col = "green", xaxt='n', ylim = c(0,max(c(a,pred,CI_l,CI_U))))
lines(a, type='o', col = "black")
lines(CI_l, type='o', col = "red")
lines(CI_U, type='o', col = "red")
axis(side=1, at=seq(1,length(pred),1), labels = seq(2000,2006,1))

3. linear regression
Linear regression would be a decent solution, but I afraid to use because of a small n.
fm <- lm(a ~ b[-7]) 
predict(fm, list(b = 330))

4. Vector autoregression
I've also tried vector autoregression, but this process needs a same variable length, and also gives me a meaningless result (also because of a small n, I guess)
m = matrix(NA,length(a),2)
m[,1] = a
m[,2] = b[-7]

library(vars)

summary(VAR(m))

My questions are:


*

*Is there a more sophisticated way to get the forecasts?*

*Is my second model mathematically correct?*
 A: Plotting your data shows that a and b appear to be strongly linearly correlated:
> dataset <- data.frame(b=b[1:6],a)
> plot(dataset,type="n")
> with(dataset,text(b,a,rownames(dataset)))


However, with no more than six historical observations, anything fancy like VAR or others will likely overfit. In addition, VAR forecasting really only makes sense if you need to forecast all components - but here, you already know the 2006 b component, you don't need to forecast it.
The simplest thing would be to simply regress a on b:
> model <- lm(a~b,dataset)
> model

Coefficients:
(Intercept)            b  
    17.7859       0.7409

Here is the prediction:
> predict(model,newdata=data.frame(b=b[7]))

    2006 
262.2801

You write that you are afraid of using it because of small n - but there really is nothing simpler than this, and with the relationship as obvious as it is here, this is what you should be doing.

EDIT: You could also fit an AR model to your a, but this will of course only pick up the inherent signal in a (auto.arima(a) yielded an ARIMA(0,1,0) model with drift), not the relationship with b, so it's not using information you have, which is wasteful.
Or you could do a really fancy ARIMAX model for a using b as an eXternal variable:
> library(forecast)
> ar.model <- auto.arima(a,xreg=b[1:6])
> ar.model
Series: a 
ARIMA(0,0,0) with zero mean     

Coefficients:
      b[1:6]
      0.8118
s.e.  0.0110

sigma^2 estimated as 42.47:  log likelihood=-19.76
AIC=43.52   AICc=47.52   BIC=43.1
> forecast(ar.model,xreg=b[7])
  Point Forecast    Lo 80    Hi 80    Lo 95  Hi 95
7       267.9071 259.5552 276.2589 255.1341 280.68

The result is pretty close to the one from the simple regression.
Anyway, I really wouldn't be using ARIMA(X) with only six observations. Just go with a simple regression.
