1

I'm learning Ox because it's flexible when it comes to complex econometrics models related to my work. But I'm struggling with my ordered probit model. For a simple probit model (order = 2), the function is as follows:

decl g_mX, g_mY;


fProbit(const vP, const adFunc, const avScore,
const amHessian)
{
    decl prob = probn(g_mX * vP); // vP is column vector
    
    adFunc[0] = double(
       meanc(g_mY .* log(prob) + (1-g_mY) .* log(1-prob)));

return 1; // 1 indicates success
}

In the 'main' section, I simulate my data and call the BFGS maximizer integrated in Ox package "maximize" :

main()

{
    decl ct, mx, vbeta, veps;
    
    decl vp, dfunc, ir;
    
    println("Probit example 1, run on ", date());

    ct = 546 ; 
    mx = ranbinomial(ct, 1, 1, 0.35)~ ranbinomial(ct, 2, 1, 0.45)~ranbinomial(ct,8, 1, 0.48) ;
    veps = rann(ct, 1);
    g_mX = 1~mx[][1:10]; // regressors: 1, Marital, Gender, Age, etc.
    vp0 = <.7034119;-.0416732;-.2973156;-.1419538 ;-.4537812; -.3036446;-.1783031 ;  .0619869; .0310086; .0011324; -.0310052 > ; // starting values
    g_mY = (g_mX*vp0 + veps) .> 0 ; // dependent variable: 0,1 dummy
 
    vp = <0 ;0 ;0;0 ;0;0;0 ;0;0;0; 0 >;

    MaxControl(-1, 1); // print each iteration maximize

    ir = MaxBFGS(fProbit, &vp, &dfunc, 0, TRUE);

    print("\n", MaxConvergenceMsg(ir),
        " using numerical derivatives",
        "\n Function value = ", dfunc * rows(g_mY),
        "; parameters:", vp);
    
}

It works well, with a strong convergence and vp ~ vp0.

Now suppose I have an order greater than two (dependent variable with 3 or more categories). How you code this ordered probit?

Many thanks

Tande
  • 31
  • 5

0 Answers0