reverse-shooting

Matlab scripts for reverse shooting
Log | Files | Refs | README

uufctw.m (611B)


      1 function uu=uufct(beta,X,mname,param,weights);
      2 
      3 % uufct.m   The function to be minimized u'u
      4 %   It calls the user-defined function mfct(beta,x)
      5 %  Revised 1/10/99 -- weight each u(i)^2 by weight(i) when summing up at the
      6 % very end -- equivalent to causing observation i to appear weights(i)
      7 % number of times in the data.
      8 
      9 [T col]=size(X);
     10 y=X(:,1);
     11 x=X(:,2:col);
     12 
     13 %% u=y-mfct(beta,x);
     14 if isempty(param);
     15    eval(['u=y-' mname '(beta,x);']);
     16 else;
     17    eval(['u=y-' mname '(beta,x,param);']);
     18 end;
     19 
     20 %uu=u'*u;
     21 %u2=u.^2;
     22 %uu=sum(u2.*weights);
     23 % This is equivalent to the nonlooping
     24 ux=u.*sqrt(weights);
     25 uu=ux'*ux;