# chibarsq#

## Purpose#

Computes the chi-bar-statistic and its probability for an hypothesis regarding parameters under constraints.

## Format#

{ chibar, chibarprob } = chibarsq(out, ..., c1, psi)#
Parameters:
• out (struct) – instance of a cmlmtResults structure. This structure must contain the results from a cmlmt() estimation in which the a subset of parameters is set equal to zero using c1.active – start values for those parameters are set to zero, and c1.active is set equal to a vector of zeros and ones in which zeros correspond to the parameters in the hypothesis and ones to the remaining parameters.

• ... (various) – optional arguments in the cmlmt() estimation generating out.

• c1 (struct) – instance of a cmlmtControl structure. It must contain the constraint specifications under the alternate hypothesis.

• psi (vector) – indices of the set of parameters in the hypothesis. The indices can be determined from the list of the parameters generated by calling pvGetParnames() on the instance of the PV structure in out.

Returns:
• chibar (scalar) – Chi-bar-square statistic of hypothesis.

• chibarprob (scalar) – probability of chibar.

## Remarks#

chibarsq() computes the chi-bar-square statistic for the hypothesis $$H(\theta) = 0 vs. H(\theta) \geq 0$$, where theta is the vector of estimated parameters, and H() is a constraint function of the parameters.

First, the model with $$H(\theta) = 0$$ is estimated by calling cmlmt(). The simplest way to do this is to use the active member of the cmlmtControl structure. The covParType member must also be set to 2 so that the Jacobian or score, i.e., the matrix of first derivatives by observation, is generated.

Next chibarsq() is called with the first argument being the instance of the cmlmtResults structure output by the call to cmlmt(), the second argument the DS data structure, and the third argument the cmlmtControl structure containing the specification of the alternate hypothesis, $$H(\theta) \geq 0$$.