title: how to find the standard errors of an estimated parameters
body: <p>I estimated parameters by using a maximum likelihood method through the function <code>fminsearch</code>, but I don't know how to come up with the standard errors of the parameters (to compute the <em>p</em>-values). </p>
  
  <p>This my model code:</p>
  
  <pre><code>function f = myRegime1(p,y,o)
  
      T   = size(y);
      x   = 0;
      xi1 = 0.8;
      xi2 = 1-xi1;
      LL  = 0;
  
      for t = 2:T
  
          k = o(t);
  
          p11 = exp(p(1)+p(2)*k) / (1+exp(p(1)+p(2)*k));
          p22 = exp(p(3)+p(4)*k) / (1+exp(p(3)+p(4)*k));
  
          s = y(t);
          f = p(5) + p(6)*o(t);
  
          x(t) = s-f;
  
          e1 = x(t)-p(7);
          e2 = x(t)-p(8);
  
          L1 = -log(2*pi) - log(sqrt(p( 9))) - e1^2/(2*p( 9));
          L2 = -log(2*pi) - log(sqrt(p(10))) - e2^2/(2*p(10));
  
          L = xi1*p11*L1 + xi1*(1-p11)*L2 + xi2*p22*L2 + xi2*(1-p22)*L1;
  
          xi1 = (xi1*p11*L1 + xi2*(1-p22)*L1)/L;
          xi2 = (xi1*(1-p11)*L2 + xi2*p22*L2)/L;
  
          LL = LL+L;
      end
  
      f = LL;
  
  end
  </code></pre>