#include <oxstd.h>
#import "bprobit"

main()
{
    decl probitobj, ct = 100, x, y;

    probitobj = new Bprobit();            // create object
    probitobj.Create(1, 1, 1, ct, 1);   // create database
    probitobj.Deterministic(FALSE);     // create constant

    x = ranu(ct, 1);                       // artificial x
    y = 1 + x + rann(ct, 1);               // artificial y
    y = y .< 1 .? 0 .: 1;   // translate into 0,1 variable
    probitobj.Append(x ~ y, {"x", "y"});// extend database
    probitobj.Info();            // print database summary
                          // formulate the model: y on 1,x
    probitobj.Select(Y_VAR, { "y",0,0 } );
    probitobj.Select(X_VAR, { "Constant",0,0, "x",0,0 } );
    probitobj.SetSelSample(-1, 1, -1, 1);   // full sample

    probitobj.Estimate();                      // maximize

    delete probitobj;
}
