Documentation of getncap


Global Index (short | long) | Local contents | Local Index (short | long)


Function Synopsis

[Ncap,d]=getncap(th)

Help text

GETNCAP Gets the number of data points and the number of parameters for a model.

   [Ncap,D]=getncap(TH);

   TH: The model, defined in the THETA-format (See help theta)
   Ncap: The number of data points (samples) that were used to estimate TH
      (If the model is not estimated, Ncap is returned as [])
   D: The number of estimated parameters in the model structure

Cross-Reference Information

This function calls This function is called by

Listing of function getncap

function [Ncap,d]=getncap(th)

%   L. Ljung 10-2-90,9-9-94
%   Copyright (c) 1986-98 by The MathWorks, Inc.
%   $Revision: 2.3 $  $Date: 1997/12/02 03:43:42 $

if nargin < 1
   disp('Usage: [NUMBER_OF_DATA,NUMBER_OF_PARS] = GETNCAP(TH)')
   return
end

Ncap=[];
if isthss(th), d=th(1,5);else nu=th(1,3);
d=th(1,4)+sum(th(1,5:4+nu))+th(1,5+nu)+th(1,6+nu)+sum(th(1,7+nu:6+2*nu));end

alpha=(th(2,1)-th(1,1))/(th(2,1)+th(1,1));
if alpha>eps,Ncap=d/alpha;end