Control Function for vglm()
vglm.control.RdAlgorithmic constants and parameters for
running vglm are set
using this function.
Usage
vglm.control(checkwz = TRUE, Check.rank = TRUE, Check.cm.rank = TRUE,
criterion = names(.min.criterion.VGAM),
epsilon = 1e-07, half.stepsizing = TRUE,
maxit = 30, noWarning = FALSE,
stepsize = 1, save.weights = FALSE,
trace = FALSE, wzepsilon = .Machine$double.eps^0.75,
xij = NULL, bhhh = FALSE, b3h.wz = 0.5, ...)Arguments
- checkwz
logical indicating whether the diagonal elements of the working weight matrices should be checked whether they are sufficiently positive, i.e., greater than
wzepsilon. If not, any values less thanwzepsilonare replaced with this value.- Check.rank
logical indicating whether the rank of the VLM matrix should be checked. If this is not of full column rank then the results are not to be trusted. The default is to give an error message if the VLM matrix is not of full column rank.
- Check.cm.rank
logical indicating whether the rank of each constraint matrix should be checked. If this is not of full column rank then an error will occur. Under no circumstances should any constraint matrix have a rank less than the number of columns.
- criterion
character variable describing what criterion is to be used to test for convergence. The possibilities are listed in
.min.criterion.VGAM, but most family functions only implement a few of these.- epsilon
positive convergence tolerance epsilon. Roughly speaking, the Newton-Raphson/Fisher-scoring iterations are assumed to have converged when two successive
criterionvalues are withinepsilonof each other.- half.stepsizing
logical indicating if half-stepsizing is allowed. For example, in maximizing a log-likelihood, if the next iteration has a log-likelihood that is less than the current value of the log-likelihood, then a half step will be taken. If the log-likelihood is still less than at the current position, a quarter-step will be taken etc. Eventually a step will be taken so that an improvement is made to the convergence criterion.
half.stepsizingis ignored ifcriterion == "coefficients".- maxit
maximum number of (usually Fisher-scoring) iterations allowed. Sometimes Newton-Raphson is used.
- noWarning
logical indicating whether to suppress a warning if convergence is not obtained within
maxititerations. This is ignored ifmaxit = 1is set.- stepsize
usual step size to be taken between each Newton-Raphson/Fisher-scoring iteration. It should be a value between 0 and 1, where a value of unity corresponds to an ordinary step. A value of 0.5 means half-steps are taken. Setting a value near zero will cause convergence to be generally slow but may help increase the chances of successful convergence for some family functions.
- save.weights
logical indicating whether the
weightsslot of a"vglm"object will be saved on the object. If not, it will be reconstructed when needed, e.g.,summary. Some family functions havesave.weights = TRUEand others havesave.weights = FALSEin their control functions.- trace
logical indicating if output should be produced for each iteration. Setting
trace = TRUEis recommended in general because VGAM fits a very broad variety of models and distributions, and for some of them, convergence is intrinsically more difficult. Monitoring convergence can help check that the solution is reasonable or that a problem has occurred. It may suggest better initial values are needed, the making of invalid assumptions, or that the model is inappropriate for the data, etc.- wzepsilon
small positive number used to test whether the diagonals of the working weight matrices are sufficiently positive.
- xij
A list of formulas. Each formula has a RHS giving \(M\) terms making up a covariate-dependent term (whose name is the response). That is, it creates a variable that takes on different values for each linear/additive predictor, e.g., the ocular pressure of each eye. The \(M\) terms must be unique; use
fill1,fill2,fill3, etc. if necessary. Each formula should have a response which is taken as the name of that variable, and the \(M\) terms are enumerated in sequential order. Each of the \(M\) terms multiply each successive row of the constraint matrix. Whenxijis used, the use ofform2is also required to give every term used by the model.A formula or a list of formulas.
The function
Selectcan be used to select variables beginning with the same character string.
- bhhh
Logical. Use the BHHH method? Although VGAM is primarily based on Fisher scoring, the EIM for some models cannot be derived or be computed. For those, the Berndt-Hall-Hall-Hausman (BHHH) algorithm can be used and/or be an alternative. Being an approximation based on the first derivatives, the results should not differ much if \(n\) is very large, however for small \(n\) the difference can be substantial, e.g., Greene (2012). Note that Fisher scoring is recommended over the BHHH method in general. Note also that, internally, the code works only for VGAM family functions that have
@derivreturning the first derivatives in the formc(w) * d1mat. That's becauseb3hfun()divides it byc(w)to remove the weighting before taking the (weighted) outer-product mean.- b3h.wz
Numeric. Shrinkage factor between the BHHH working weights and what is returned in
@wz(which is usually the EIM, but might be the OIM). Is used only ifbhhh = TRUEand valid values are in \([0, 1]\). Sob3h.wz = 0.1might be very similar to Newton–Raphson for example. If so, individual negative Hessian matrices may be negative-definite depending on the response, hence it is necessary for the IRLS algorithm to shrink them towards a positive-definite matrix, such as that provided by the BHHH method.- ...
other parameters that may be picked up from control functions that are specific to the VGAM family function.
Details
Most of the control parameters are used within
vglm.fit and you will have to look at that to
understand the full details.
Setting save.weights = FALSE is useful for some
models because the weights slot of the object
is the largest and so less memory is used to store the
object. However, for some VGAM family function,
it is necessary to set save.weights = TRUE because
the weights slot cannot be reconstructed later.
Value
A list with components matching the input names.
A little error
checking is done, but not much.
The list is assigned to the control slot of
vglm objects.
References
Yee, T. W. and Hastie, T. J. (2003). Reduced-rank vector generalized linear models. Statistical Modelling, 3, 15–41.
Berndt, E. K. and Hall, B. H. and Hall, R. E. and Hausman, J. A. (1974). Estimation and inference in nonlinear structural models. Annals of Economic and Social Measurement, 3–4, 653–665.
Greene, W. H. (2012). Econometric Analysis, 7th Edition. Prentice Hall: Harlow, Essex, UK.
Note
Reiterating from above,
setting trace = TRUE is recommended in general.
In Example 2 below there are two covariates that have
linear/additive predictor specific values. These are
handled using the xij argument.
Warning
For some applications the default convergence criterion should
be tightened.
Setting something like criterion = "coef", epsilon = 1e-09
is one way to achieve this, and also add
trace = TRUE to monitor the convergence.
Setting maxit to some higher number is usually not
needed, and needing to do so suggests something is wrong, e.g.,
an ill-conditioned model, over-fitting or under-fitting.
See also
vglm,
TypicalVGAMfamilyFunction,
fill1.
The author's homepage has further documentation about
the xij argument;
see also Select.