Generic function that computes Wald test statistics evaluated at the null values (consequently they do not suffer from the Hauck-Donner effect).

```
wald.stat(object, ...)
wald.stat.vlm(object, values0 = 0, subset = NULL, omit1s = TRUE,
all.out = FALSE, iterate = TRUE, trace = FALSE,
as.summary = FALSE, ...)
```

object

A `vglm`

fit.

values0

Numeric vector. The null values corresponding to the null hypotheses. Recycled if necessary.

subset

Same as in `hdeff`

.

omit1s

Logical. Does one omit the intercepts? Because the default would be to test that each intercept is equal to 0, which often does not make sense or is unimportant, the intercepts are not tested by default. If they are tested then each linear predictor must have at least one coefficient (from another variable) to be estimated.

all.out

Logical. If `TRUE`

then a list is returned containing
various quantities such as the SEs,
instead of just the Wald statistics.

iterate

Logical. If `TRUE`

then IRLS iterations are performed to
get MLEs of the *other* regression coefficients, subject
to that one coefficient equal to the appropriate
`values0`

value.
If `FALSE`

then the other regression coefficients have
values obtained at the original fit.
It is recommended that a `TRUE`

be used as the answer
tends to be more accurate.
If the large model matrix only has one column and
`iterate = TRUE`

then an error will occur because
there are no *other* regression coefficients to estimate.

trace

Logical. If `TRUE`

then some output is produced as
the IRLS iterations proceed.
The value `NULL`

means to use the `trace`

value of the fitted object;
see `vglm.control`

.

as.summary

Logical. If `TRUE`

then the usual (or unmodified)
Wald statistics etc. are extracted from `summary(object)`

.
These may suffer from the HDE; and the SEs are evaluated
at the MLE of the original object so that effectively
`iterate = FALSE`

.
If `TRUE`

then most other arguments will
be ignored or overwritten.

This argument may be renamed to `as.glm`

because
the Wald statistics will be computed in the same way
as `summary(glm())`

.

…

Ignored for now.

By default the signed square root of the Wald statistics
whose SEs are computed at one each of the null values.
If `all.out = TRUE`

then a list is returned with the
following components:
`wald.stat`

the Wald statistic,
`SE0`

the standard error of that coefficient,
`values0`

the null values.
Approximately, the default Wald statistics output are standard normal
random variates if each null hypothesis is true.

This function has not yet been thoroughly tested.
Convergence failure is possible for some models applied to
certain data sets; it is a good idea to set `trace = TRUE`

to monitor convergence.
For example, for a particular explanatory variable,
the estimated regression coefficients
of a non-parallel cumulative logit model
(see `cumulative`

) are ordered,
and perturbing one coefficient might disrupt the order
and create numerical problems.

By default, `summaryvglm`

and most regression
modelling functions such as `summary.glm`

compute the standard errors (SEs) of the estimates at the MLE and
not at 0.
This make it vulnerable to the Hauck-Donner effect (HDE)
(see `hdeff`

).
One solution is to compute the SEs
at 0 (or more generally, at the values of
the argument `values0`

).
This function does that.
The two variants of Wald statistics are asymptotically equivalent;
however in small samples there can be an appreciable difference,
and the difference can be large if the estimates are near
to the boundary of the parameter space.

None of the tests here are joint,
hence the degrees of freedom is always unity.
For a factor with more than 2 levels one can use
`anova.vglm`

to test for the significance of the factor.
If `iterate = FALSE`

then
one retains the MLEs of the original fit for the values of
the other coefficients, and replaces one coefficient at a
time by the value 0 (or whatever specified by `values0`

).
One alternative would be to recompute the MLEs of the other
coefficients after replacing one of the values;
this is the default because `iterate = TRUE`

.
Just like the original IRLS iterations,
note that the iterations here are not guaranteed to converge.

Almost all VGAM family functions use the EIM and not
the OIM; this affects the resulting standard errors.
Also, regularity conditions are assumed for the Wald,
likelihood ratio and score tests; some VGAM family functions
such as `alaplace1`

are experimental and
do not satisfy such conditions, therefore naive inference is
hazardous.

The default output of this function can be seen by
setting `wald0.arg = TRUE`

in `summaryvglm`

.

`lrt.stat`

,
`score.stat`

,
`summaryvglm`

,
`summary.glm`

,
`anova.vglm`

,
`vglm`

,
`hdeff`

,
`hdeffsev`

.

```
# NOT RUN {
set.seed(1)
pneumo <- transform(pneumo, let = log(exposure.time),
x3 = rnorm(nrow(pneumo)))
(fit <- vglm(cbind(normal, mild, severe) ~ let + x3,
propodds, data = pneumo))
wald.stat(fit) # No HDE here
summary(fit, wald0 = TRUE) # See them here
coef(summary(fit)) # Usual Wald statistics evaluated at the MLE
wald.stat(fit, as.summary = TRUE) # Same as previous line
# }
```

Run the code above in your browser using DataLab