Next: goodfactors() Up: MacAnova Help File Previous: glmpred()   Contents

glmtable()

Usage:
glmtable([wtdmeans:T or x:vals, estimate:F, seest:F, sepred:T, n:N]\
  [,silent:T]) or
glmtable(Term,[wtdmeans:T or x:vals, estimate:F, seest:F, sepred:T,\
  n:N] [,silent:T]) where vals is REAL vector and TERM is CHARACTER
  scalar of form "A.B. ...", where A, B are factors in current GLM
  model, N is a positive REAL scalar or vector or array of positive
  numbers.



Keywords: glm, anova
glmtable() computes tables of fitted values (estimated cell expected
values) and their standard errors based on the computations of the most
recent GLM (generalized linear or linear model) command such as anova()
or poisson().  It returns a structure with components "estimate" and
"SEest" containing the tables, each of which has a dimension for each
factor in the model, in the order the variables appear in the model.  If
there are variates in the model, the fitted values are computed with
each variate set to its unweighted mean value and thus are what are
sometimes called the covariate adjusted cell means.

If only one array of values is computed, glmtable() returns that array,
not a structure.

glmtable(silent:T) does the same except that certain advisory messages
are suppressed.  'silent:T' can be used with any other keywords.  The
default value of 'silent' is False unless the value of option'
'warnings' is False.

glmtable(sepred:T) adds component SEpred to the output structure
containing a table of prediction standard errors.  This is only
permissible after regress(), anova() or manova() and their weighted
alternatives.

glmtable(seest:F) suppresses the computation of standard errors.

glmtable(estimate:F) suppresses the computation of expected values.
This option is legal only after anova(), manova(), regress() and their
weighted alternatives.

Caution: After anova(), manova() and regress(), standard errors are
computed using the final error mean square in the model.  This may not
be appropriate with mixed models, including split plot designs.

glmtable(wtdmeans:T [,...]) does the same except it adjusts cell fitted
values to the weighted means of the variates.  You can use wtdmeans:T
only when there are variates and when the previous GLM command used
unweighted OLS (anova() or manova() with no weights supplied).  This
option would be probably appropriate when the weights were proportional
to sample sizes.

glmtable(x:Vals [,...]), where Vals is a REAL vector with length = the
number of variates (non-factors) in the model, does the same
computation, except it uses the elements of Vals instead of unweighted
or weighted variate means.  This option allows you to estimate cell
means that are adjusted to any level of the covariates.  Use of x:Vals
is an error if there are no variates in the current GLM model.

glmtable(Term [,...]) returns an estimated marginal table for the
factors specified by Term.  Term is a quoted string or CHARACTER scalar
of the form "Name1.Name2.Name3....", where Name1, Name2, ... are names
of factors in the current GLM model.  If there are k factor names in
Term, the value will be an array with k dimensions (vector if k = 1,
matrix if k = 2), with the dimensions ordered in the same order as in
the model, not the order in Term if that is different.  You cannot
use glmtable(term [,...]) after anova() with a balanced design unless
Term includes all the factors in the model.
  Example:
  Cmd> glmtable("a.b", x:17) # same as glmtable("b.a",x:17)

glmtable(term:k [,...]) is equivalent to glmtable(TERMNAMES[k] [,...]),
computing the marginal table matching term k in the model.
Example:
  Cmd> glmtable(term:3, x:17).

You can use sepred:T when estimating a marginal table.

Comment: When the marginal table for any term in the model contains
empty cells, especially when a factor is nested in another with
different numbers of levels, the estimated means may not be what you
want.

For GLM functions involving a binomial response variable (logistic(),
probit(), glmfit() with dist:"binomial"), the values computed are the
estimated probabilities p of "success" associated with each cell.  In
this case, you can also use keyword phrase n:N, where N is a REAL
variable, to specify the number of trials for each cell.  N can be a
scalar, a vector whose length matches the size of the table, or a matrix
or array whose dimensions match those of the table.  The resulting table
is a table of N*p.

After GLM functions such as poisson(), logistic(), or probit(), where
the expectation of the response is a non-linear function of a linear
combination of the predictors, the standard error is computed from the
expectation and standard error in the linear scale using the
delta-method.  When the response is binomial and you also use n:N, the
standard errors are those of N*p.  You cannot use seest:T or sepred:T
after fastanova() or ipf().

Comment: Standard errors are computed on the assumption that all effects
are fixed and not random.  When this is not appropriate, the standard
errors will usually indicate more precision than is warrented.  In
particular, this is would be the case when one factor indexes replicates
in a randomized block design and you use glmtable(Term,seest:T) to
estimate treatment means, where Term contains all the factors except
blocks.

After fitting a non-linear model by logistic(), probit(), poisson(), or
glmfit(), when Term doesn't contain all the factors in the model,
glmtable(Term) first computes the estimated marginal table in the linear
scale (logit, probit, or log) and then transforms it back into the scale
of the response.  This means that the computed marginal table is not the
marginal means of the fitted table.  For example, if b is a factor with
3 levels, after logistic("y=a*b", n:40), sum(glmtable("a.b"))/3 is not
the same as glmtable("b").

When keyword phrase coefs:F was an argument on the most recent GLM
command, glmtable() is not available.

See also topics anova(), anovapred(), glmpred(), regpred(), modelinfo(),
popmodel(), pushmodel(), 'glm'.


Gary Oehlert 2003-01-15