Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    I have tried several options in order to overcome this issue but have not succedeed so far. Sorry to bother you again Christophe Kolodziejczyk , but any insight or opinion about this problem would be of utmost importance to me.

    Comment


    • #17
      Nicolas Larrea p[1] is well defined for Mata og should not cause any problem. You can assign it to a new variable if you want to make the the code more readable.
      Since you have an equality restriction on the mean of the two distributions, you can incorporate this in your evaluator. Actually you can now drop one parameter from the problem

      Code:
      rho_final = st_numscalar("rho_final")
      void eval0(todo, p, x_k, u_mean, u_m, u_m_1, v, g, H) {
      external rho_final // , x_k, u_mean, u_m, u_m_1 pr = p[1] miu = p[2] miu2 = -pr/(1-pr)*miu sigma = exp(p[3..4]) v = sum(normalden(x_k) - sum((x_k-u_mean)/rho_final):*(pr*normalden(u_m, miu, sigma[1]) + (1-pr)*normalden(u_m, miu2, sigma[2]) - pr*normalden(u_m_1, miu, sigma[1]) + (1-pr)*normalden(u_m_1, miu2, sigma[2])):/(u_m - u_m_1))^2
      } S = optimize_init() optimize_init_which(S, "min") optimize_init_evaluator(S, &eval0()) optimize_init_params(S, (0.5, 0, 0, 0)) optimize_init_argument(S, 1, x_k) optimize_init_argument(S, 2, u_mean) optimize_init_argument(S, 3, u_m) optimize_init_argument(S, 4, u_m_1) v = optimize(S)
      Last edited by Christophe Kolodziejczyk; 05 Feb 2023, 01:59.

      Comment


      • #18
        Thanks a lot Christophe Kolodziejczyk !! I have corrected everything. The parameters were estimated. Unfortunately, there's something not really logical.

        pr = 0.580159561
        miu = 0.4637609069
        miu2 = -0.64085
        sigma = -1.6602764
        sigma2 = 0.0996514998

        The first sigma is negative. Since this parameter accounts for one of the variances it does not make sense. In fact, it calls my attention because we constructed them with the exponentials so as not to be negative values.

        What do you think could be the problem?
        Last edited by Nicolas Larrea; 05 Feb 2023, 14:47.

        Comment


        • #19
          Nicolas Larrea I am pleased to see that you got some results. The program estimates log(sigma1) and log(sigma2), so you need to exponentiate these parameters to get results you can interpret as variances. You can also ensure that the parameter for the probablity is between zero and one by applying another transformation, i.e. the inverse logit function exp(x)/(1+exp(x)) or invlogit(x)

          Comment

          Working...
          X