VGAM (version 0.8-3)

vglm.control: Control function for vglm

Description

Algorithmic constants and parameters for running vglm are set using this function.

Usage

vglm.control(checkwz = TRUE, criterion = names(.min.criterion.VGAM),
             epsilon = 1e-07, half.stepsizing = TRUE,
             maxit = 30, stepsize = 1, save.weight = FALSE,
             trace = FALSE, wzepsilon = .Machine$double.eps^0.75, 
             xij = NULL, ...)

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 than wzepsilon are replaced wit
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 criterion values are within epsilon of 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-likelih
maxit
maximum number of Newton-Raphson/Fisher-scoring iterations allowed.
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 zer
save.weight
logical indicating whether the weights slot of a "vglm" object will be saved on the object. If not, it will be reconstructed when needed, e.g., summary. Some family functions have save.weight=TRUE
trace
logical indicating if output should be produced for each iteration. Setting trace=TRUE is recommended in general because VGAM fits a very broad variety of models and distributions, and for some of them, convergence is intrins
wzepsilon
small positive number used to test whether the diagonals of the working weight matrices are sufficiently positive.
xij
A formula or 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., t
...
other parameters that may be picked up from control functions that are specific to the VGAM family function.

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.

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.weight=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.weight=TRUE because the weights slot cannot be reconstructed later.

References

Yee, T. W. and Hastie, T. J. (2003) Reduced-rank vector generalized linear models. Statistical Modelling, 3, 15--41.

See Also

vglm, fill. The author's homepage has further documentation about the xij argument.

Examples

Run this code
# Example 1.
pneumo = transform(pneumo, let = log(exposure.time))
vglm(cbind(normal, mild, severe) ~ let, multinomial, data = pneumo,
     crit = "coef", step = 0.5, trace = TRUE, eps = 1e-8, maxit = 40)


# Example 2. The use of the xij argument (simple case).
ymat = rdiric(n <- 1000, shape=rep(exp(2), len=4))
mydat = data.frame(x1=runif(n), x2=runif(n), x3=runif(n), x4=runif(n),
                   z1=runif(n), z2=runif(n), z3=runif(n), z4=runif(n))
mydat = transform(mydat, X=x1, Z=z1)
mydat = round(mydat, dig=2)
fit2 = vglm(ymat ~ X + Z,
            dirichlet(parallel=TRUE), data=mydat, trace=TRUE,
            xij = list(Z ~ z1 + z2 + z3 + z4,
                       X ~ x1 + x2 + x3 + x4),
            form2 = ~  Z + z1 + z2 + z3 + z4 +
                       X + x1 + x2 + x3 + x4)
head(model.matrix(fit2, type="lm"))   # LM model matrix
head(model.matrix(fit2, type="vlm"))  # Big VLM model matrix
coef(fit2)
coef(fit2, matrix=TRUE)
max(abs(predict(fit2)-predict(fit2, new=mydat))) # Predicts correctly
summary(fit2)
# plotvgam(fit2, se=TRUE, xlab="x1", which.term=1) # Bug!
# plotvgam(fit2, se=TRUE, xlab="z1", which.term=2) # Bug!
plotvgam(fit2, xlab="x1") # Correct
plotvgam(fit2, xlab="z1") # Correct




# Example 3. The use of the xij argument (complex case).
set.seed(123)
coalminers = transform(coalminers,
                       Age = (age - 42) / 5,
                       dum1 = round(runif(nrow(coalminers)), dig=2),
                       dum2 = round(runif(nrow(coalminers)), dig=2),
                       dum3 = round(runif(nrow(coalminers)), dig=2),
                       dumm = round(runif(nrow(coalminers)), dig=2))
BS = function(x, ..., df=3) bs(c(x,...), df=df)[1:length(x),,drop=FALSE]
NS = function(x, ..., df=3) ns(c(x,...), df=df)[1:length(x),,drop=FALSE]

# Equivalently...
BS = function(x, ..., df=3) head(bs(c(x,...), df=df), length(x), drop=FALSE)
NS = function(x, ..., df=3) head(ns(c(x,...), df=df), length(x), drop=FALSE)

fit3 = vglm(cbind(nBnW,nBW,BnW,BW) ~ Age + NS(dum1,dum2),
            fam = binom2.or(exchang=TRUE, zero=3),
            xij = list(NS(dum1,dum2) ~ NS(dum1,dum2) +
                                       NS(dum2,dum1) +
                                       fill(NS(dum1))),
            form2 = ~  NS(dum1,dum2) + NS(dum2,dum1) + fill(NS(dum1)) +
                       dum1 + dum2 + dum3 + Age + age + dumm,
            data = coalminers, trace=TRUE)
head(model.matrix(fit3, type="lm"))   # LM model matrix
head(model.matrix(fit3, type="vlm"))  # Big VLM model matrix
coef(fit3)
coef(fit3, matrix=TRUE)
plotvgam(fit3, se=TRUE, lcol="red", scol="blue", xlab="dum1")

Run the code above in your browser using DataLab