The model y = X &beta +&epsilon is fit using least squares, given the constraints A &beta &ge0.
Here &epsilon is assumed to be approximately normal with mean zero and covariance matrix &sigma2I. The design matrix X is n by k full column rank, and &beta is a parameter vector in &realk.
The constraint matrix A is assumed to be "irreducible" (Meyer 1999). This means that the constraints are "nonredundant;" specifically, no row of A is a positive linear combination of other rows, and there is not a positive linear combination of rows of A that is equal to the zero vector. If A is full row-rank, then A is irreducible.
For the following code has argument the user provides y, X, and A. The code returns the least-squares constrained estimate for &beta as well as the p-value for the test H0:A &beta=0, versus H1:A &beta>0. The B-bar test is used.