The estimation functions
glmest
and
doglm
are able to handle special cases as prior weights, replications (automatic
search for replications) and constraints on parameters (fix parameters).
We will demonstrate this by means of a second running example.
Consider the lines
x = read("lizard") x = paf(x,(x[,6]!=0)) y = x[,5] m = x[,6] x = matrix(rows(x))~x[,1:3]~(x[,4]==1)~(x[,4]==2)
We proceed as follows in the estimation here:
opt=glmopt("wx",m) g=glmest("bilo",x,y,opt)
Content of object g.b [1,] 1.94469 [2,] 1.12999 [3,] -0.76263 [4,] -0.84727 [5,] 0.22711 [6,] -0.73681An output display can be obtained manually in this case, see Subsection 7.5.2.
There are two types of replications (or ties) that can occur:
For models other than the Binomial, the original matrix x (with
multiple entries) and the original response vector y should be given to
glmest
or
doglm
. Both will search automatically
for replications in data.
The second case (replications in x and y jointly) can simply be handled by giving the number of replications as component opt.wx in the list of optional parameters opt. opt.wx may be a single number if the number of replications in x and y is constant. For an example, see the previous Subsection 7.3.1.
Returning to the running lizard example of Subsection 7.3.1, the resulting vector of estimated coefficients is
Content of object g.b [1,] 1.94469 [2,] 1.12999 [3,] -0.76263 [4,] -0.84727 [5,] 0.22711 [6,] -0.73681Suppose now that we are interested in estimating the same model under the constraint that the last coefficient equals exactly -1. The new estimate could be used in hypothesis testing.
This type of constrained estimation can be done by introducing an offset into the model and omitting the last variable instead. Continuing with
offset=-x[,6] opt=glmopt("off",offset,opt) c=glmest("bilo",x[,1:5],y,opt)
Content of object b [1,] 2.0685 [2,] 1.1409 [3,] -0.7703 [4,] -0.86002 [5,] 0.11794