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.m
    path of file: ./repos/bspm/thirdparty/spm12/toolbox/spectral
    
    the code of the file until where you have to start completion: function [ar] = spm_ar (Z,p,verbose)
% Bayesian autoregressive modelling
% FORMAT [ar] = spm_ar (Z,p,verbose)
%

    
function [ar] = spm_ar (Z,p,verbose)
% Bayesian autoregressive modelling
% FORMAT [ar] = spm_ar (Z,p,verbose)
%
% y_pred (t) = -\sum_{i=1}^p a_i y (t-i) + e (t)
% Note the sign and ordering 
%
% The noise, e(t), is Gaussian
%
% Z             [N x 1] univariate time series 
% p             (scalar) order of model
% verbose       1=print out fitting progress (default=0)
%
% ar            data structure
% ----------------------------------
% ar.a_mean     AR coefficients
% ar.a_cov
% ar.mean_beta  error precision 
% ar.b_beta
% ar.c_beta
% ar.mean_alpha weight precision 
% ar.b_alpha
% ar.c_alpha
% ar.y          targets
% ar.y_pred     predictions
% ar.r2         proportion of variance explained
% ar.p          model order
% ar.fm         negative free energy
%
% For algorithmic details see:
%
% W.D. Penny and S.J. Roberts. Bayesian Methods for Autoregressive Models.
% In IEEE Workshop on Neural Networks for Signal Processing, Sydney Australia, 2000
%___________________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging

% Will Penny 
% $Id: spm_ar.m 1276 2008-03-28 18:29:19Z guillaume $

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