R: Contrasts and estimable linear functions of model...
estimable
R Documentation
Contrasts and estimable linear functions of model coefficients
Description
Compute and test contrasts and other estimable linear
functions of model coefficients for for lm, glm, lme,
and geese objects
Usage
estimable(obj, cm, beta0, conf.int=NULL, show.beta0, ...)
## Default S3 method:
estimable(obj, cm, beta0, conf.int=NULL, show.beta0, joint.test=FALSE, ...)
## S3 method for class 'mlm'
estimable(obj, cm, beta0, conf.int=NULL, show.beta0, ...)
Arguments
obj
Regression (lm, glm, lme,
mlm) object.
cm
Vector, List, or Matrix specifying estimable linear functions or
contrasts. See below for details.
beta0
Vector of null hypothesis values
conf.int
Confidence level. If provided, confidence intervals
will be computed.
joint.test
Logical value. If TRUE a 'joint' Wald test for the
hypothesis L %*% beta=beta0 is performed.
Otherwise 'row-wise' tests are performed, i.e. (L %*% beta)[i]=beta0[i]
show.beta0
Logical value. If TRUE a column for beta0 will be
included in the output table. Defaults to TRUE when beta0 is
specified, FALSE otherwise.
...
ignored
Details
estimable computes an estimate, test statitic, significance
test, and (optional) confidence interval for each linear functions of
the model coefficients specified by cm.
The estimable function(s) may be specified via a vector, list, or
matrix. If cm is a vector, it should contained named elements
each of which gives the coefficient to be applied to the
corresponding parameter. These coefficients will be used to construct
the contrast matrix, with unspecified model parameters assigned zero
coefficients. If cm is a list, it should contain one or more
coefficient vectors, which will be used to construct rows of the
contrast matrix. If cm is a matrix, column names must match (a
subset of) the model parameters, and each row should contain the
corresponding coefficient to be applied. Model parameters which are
not present in the set of column names of cm will be set to zero.
The estimates and their variances are obtained by applying the
contrast matrix (generated from) cm to the model estimates
variance-covariance matrix. Degrees of freedom are obtained from the
appropriate model terms.
The user is responsible for ensuring that the specified
linear functions are meaningful.
For computing contrasts among levels of a single factor,
fit.contrast may be more convenient. For computing contrasts
between two specific combinations of model parameters, the
contrast function in Frank Harrell's 'rms' library
(formerly 'Design') may be more convenient.
Value
Returns a matrix with one row per linear function. Columns contain
the beta0 value (optional, see show.beta0 above), estimated
coefficients, standard errors, t values, degrees of freedom, two-sided
p-values, and the lower and upper endpoints of the
1-alpha confidence intervals.
Note
The estimated fixed effect parameters of lme objects may have
different degrees of freedom. If a specified contrast includes
nonzero coefficients for parameters with differing degrees of freedom,
the smallest number of degrees of freedom is used and a warning
message is issued.