title: Error in matrix dimension mismatch
body: <p>I am trying to model a vector data containing 200 sample points denoting a measurement.I want to see "goodness of fit" and after reading I found that this can be done by predicting the next set of values(I am not that confident though if this is the correct way).I am stuck at this since the following code gives an error and I am just unable to solve it.Can somebody please help in removing the error </p>
  
  <pre><code>Error using  * 
  Inner matrix dimensions must agree.
  
  Error in data_predict (line 27)
      ypred(j) = ar_coeff' * y{i}(j-1:-1:j-p);
  </code></pre>
  
  <p>Also,can somebody tell me how to do the same thing i.e get the coefficients using nonlinear AR modelling,moving average and ARMA since using the command nlarx() did not return any model coefficients?
  <strong>CODE</strong></p>
  
  <pre><code>if ~iscell(y); y = {y}; end
  model = ar(y, 2, 'yw');
  
  %prediction
  yresiduals=[];
  nsegments=length(y);
  
  ar_coeffs = model.a;
  ar_coeff=[ar_coeffs(2) ar_coeffs(3)]
  for i=1:nsegments
    pred = zeros(length(y{i}),1);
    for j=p+1:length(y{i})
      ypred(j) = ar_coeff(:)' * y{i}(j-1:-1:j-p);
    end
    yresiduals = [yresiduals; y{i}(p+1:end) - ypred(p+1:end)];
  end
  </code></pre>