I wish to implement the algorithm from the paper: Singular Spectrum Analysis With Conditional Predictions for Real-Time State Estimation and Forecasting in R. I'm having trouble with Step 2 of the algorithm:
So say I have the following extended lag-embedded matrix X̃ of size M x N (4 x 20):
1.0135518 -0.7113242 -0.3906069 1.5652030 0.0439317 -1.165609 1.0701692 1.0825379 -1.2239744 -0.0321446 1.1815997 -1.4969448 -0.7455299 1.0973884 -0.2188716 -1.0719573 0.9922009 0.4374216 -1.6880219 0.2609807
-0.7113242 -0.3906069 1.5652030 0.0439317 -1.1656093 1.070169 1.0825379 -1.2239744 -0.0321446 1.1815997 -1.4969448 -0.7455299 1.0973884 -0.2188716 -1.0719573 0.9922009 0.4374216 -1.6880219 0.2609807 NA
-0.3906069 1.5652030 0.0439317 -1.1656093 1.0701692 1.082538 -1.2239744 -0.0321446 1.1815997 -1.4969448 -0.7455299 1.0973884 -0.2188716 -1.0719573 0.9922009 0.4374216 -1.6880219 0.2609807 NA NA
1.5652030 0.0439317 -1.1656093 1.0701692 1.0825379 -1.223974 -0.0321446 1.1815997 -1.4969448 -0.7455299 1.0973884 -0.2188716 -1.0719573 0.9922009 0.4374216 -1.6880219 0.2609807 NA NA NA
NB: D here is 1.
How would I code the above Step 2 in R to estimate the NAs?