You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: spm_ar_pred.m
    path of file: ./repos/spm/toolbox/spectral
    
    the code of the file until where you have to start completion: function [y_pred,y,r2] = spm_ar_pred (Z,ar)
% Make predictions from Bayesian autoregressive models
% FORMAT [y_pred,y,r2] = spm_ar_pred (Z,ar)
%
% Z             [N x 1] univariate time series 
% ar            data structure - see spm_ar.m
%
% y_pred        (one-step ahead) predictions 
% y             the values we are 'predicting'
% r2            proportion of variance explained
%__________________________________________________________________________

% Will Penny

    
function [y_pred,y,r2] = spm_ar_pred (Z,ar)
% Make predictions from Bayesian autoregressive models
% FORMAT [y_pred,y,r2] = spm_ar_pred (Z,ar)
%
% Z             [N x 1] univariate time series 
% ar            data structure - see spm_ar.m
%
% y_pred        (one-step ahead) predictions 
% y             the values we are 'predicting'
% r2            proportion of variance explained
%__________________________________________________________________________

% Will Penny
% Copyright (C) 2008-2022 Wellcome Centre for Human Neuroimaging


if nargin < 2, 
   disp('spm_ar_pred.m needs at least two arguments'); 
   return
end