maxlikmtProfileLimits#
Purpose#
Computes confidence limits by inversion of the likelihood ratio statistic.
Format#
- out1 = maxlikmtProfileLimits(&logl, out0[, ...., c1])#
- Parameters:
&logl (pointer) – Pointer to log-likelihood function used to generate results of an estimation by a call to
maxlikmt()
.out0 (struct) – Instance of
maxlikmtResults
structure containing results of an estimation generated by a call tomaxlikmt()
.... (Various) – Optional input arguments. They can be any set of structures, matrices, arrays, strings, required to compute the log-likelihood function.
c1 – The set of optional input arguments must contain the instance of the
maxlikmtResults
structure used in the call to
maxlikmt()
that produced the results in out0.c1.bayesAlpha
Exponent of the Dirichlet random variates used in the weighted bootstrap. Default = 1.4.
c1.priorProc
Pointer to a procedure for computing the prior. Assumes a uniform prior if not provided.
c1.numSamples
Number of re-samples in the weighted likelihood bootstrap.
c1.BayesFname
Filename for the simulated posterior parameters dataset. Defaults to a unique “BAYESxxxx” pattern.
c1.maxBootTime
Maximum time allowed for resampling.
c1.Bounds
Bounds on parameters, either 1x2 for all parameters or Kx2 for individual parameter bounds. Default = {-1e256, 1e256}.
c1.algorithm
Descent algorithm for optimization, includes BFGS, DFP, Newton, and BHHH.
c1.switch
Controls algorithm switching based on various performance metrics.
c1.lineSearch
Method for line search in optimization, includes augmented trust region method and others. Default varies based on constraints.
c1.active
Kx1 vector to control which parameters are active or fixed at start value.
c1.numObs
Number of observations, required if the log-likelihood function returns a scalar.
c1.maxIters
Maximum number of iterations for the optimization process. Default = 10000.
c1.tol
Convergence tolerance, optimization stops when all elements of the direction vector are below this value. Default = 1e-5.
c1.weights
Vector of weights for the objective function returning a vector. Default = 1.
c1.covParType
Determines the type of covariance matrix computed, QML or ML. Default = 1.
c1.alpha
Probability level for statistical tests. Default = .05.
c1.feasibleTest
If nonzero, parameters are tested for feasibility before computing the function in line search. Default = 1.
c1.maxTries
Maximum number of attempts in random search. Default = 100.
c1.randRadius
Radius of the random search, if attempted. Default = .001.
c1.gradMethod
Method for computing numerical gradient, includes central, forward, and backward difference.
c1.hessMethod
Method for computing numerical Hessian, similar options as gradient computation.
c1.gradStep
Increment size for computing numerical gradient, can be scalar or Kx1 vector.
c1.hessStep
Increment size for computing numerical Hessian, options similar to gradStep.
c1.gradCheck
If nonzero and analytical gradients/Hessian provided, numerical versions are computed for comparison.
c1.state
Seed for random number generator, ensuring reproducibility.
c1.title
Title of the run, for identification in output.
c1.printIters
If nonzero, iteration information is printed. Default = 0.
c1.disableKey
If nonzero, keyboard input is disabled during execution.
- Returns:
out1 (struct) – Instance of
maxlikmtResults
structure that is a duplicate of out0 except that the member, out1.profileLimits, has been set to the confidence limits by inversion of the likelihood ratio statistic.
Example#
library maxlikmt;
// Define the log-likelihood function
proc lpr(struct PV p, y, x, ind);
local s2, b0, b, yh, u, res, g1, g2;
struct modelResults mm;
b0 = pvUnpack(p,"b0");
b = pvUnpack(p,"b");
s2 = pvUnpack(p,"variance");
yh = b0 + x * b;
res = y - yh;
u = y[.,1] ./= 0;
if ind[1];
mm.function = u.*lnpdfmvn(res,s2) + (1-u).*(ln(cdfnc(yh/sqrt(s2))));
endif;
if ind[2];
yh = yh/sqrt(s2);
g1 = ((res~x.*res)/s2)~((res.*res/s2)-1)/(2*s2);
g2 = (-(ones(rows(x),1)~x)/sqrt(s2))~(yh/(2*s2));
g2 = (pdfn(yh)./cdfnc(yh)).*g2;
mm.gradient = u.*g1 + (1-u).*g2;
endif;
retp(mm);
endp;
struct PV p0;
p0 = pvPack(pvCreate, 1, "b0");
p0 = pvPack(p0, 1|1|1, "b");
p0 = pvPack(p0, 1, "variance");
struct maxlikmtControl c0;
c0 = maxlikmtcontrolcreate;
c0.title = "Tobit Example";
c0.Bounds = {-10 10, -10 10, -10 10, -10 10, .1 10};
z = loadd(getGAUSSHome("pkgs/maxlikmt/examples/maxlikmttobit.dat"));
y = z[., 1];
x = z[., 2:4];
struct maxlikmtResults out1;
out1 = maxlikmt(&lpr, p0, y, x, c0);
// Compute limits by inversion of likelihood ratio statistic
out1 = maxlikmtProfileLimits(&lpr, out1, y, x, c0);
// Print the results
call maxlikmtPrt(out1);