ci.lin {Epi}R Documentation

Compute linear functions of parameters with s.e.

Description

For a given model object the function computes a linear function of the parameters and the corresponding standard errors, p-values and confidence intervals.

Usage

ci.lin( obj,
    ctr.mat = NULL,
     subset = NULL,
      diffs = FALSE,
       fnam = !diffs,
       vcov = FALSE,
      alpha = 0.05,
        Exp = FALSE )

Arguments

obj A model object (of class lm, glm, lme, coxph or polr).
ctr.mat Contrast matrix to be multiplied to the parameter vector, i.e. the desired linear function of the parameters.
subset The subset of the parameters to be used. If given as a character vector, the elements are in turn matched against the parameter names (using grep) to find the subset. Repeat parameters may result from using a character vector. This is considered a facility.
diffs If TRUE, all differences between parameters in the subset are computed. ctr.mat is ignored. If obj inherits from lm, and subset is given as a string subset is used to search among the factors in the model and differences of all factor levels for the first match are shown. If subset does not match any of the factors in the model, all pairwise differences between parameters matching are returned.
fnam Should the common part of the parameter names be included with the annotation of contrasts? Ignored if diffs==T. If a sting is supplied this will be prefixed to the labels.
vcov Should the covariance matrix of the set of parameters be returned? If this is set, Exp is ignored.
alpha Significance level for the confidence intervals.
Exp If TRUE columns 5:6 are replaced with exp( columns 1,5,6 ).

Value

A matrix with number of rows and rownames as ctr.mat. The columns are Estimate, Std.Err, z, P, 2.5% and 97.5%. If vcov=TRUE a list with components est, the desired functional of the parameters and vcov, the variance covariance matrix of this, is returned but not printed. If Exp==TRUE the confidence intervals for the parameters are replaced with three columns: exp(estimate,c.i.).

Author(s)

Bendix Carstensen, http://www.pubhealth.ku.dk/~bxc

Examples

# Bogus data:
f <- factor( sample( letters[1:5], 200, replace=TRUE ) )
g <- factor( sample( letters[1:3], 200, replace=TRUE ) )
x <- rnorm( 200 )
y <- 7 + as.integer( f ) * 3 + 2 * x + 1.7 * rnorm( 200 )

# Fit a simple model:
mm <- lm( y ~ x + f + g )
ci.lin( mm ) 
ci.lin( mm, subset=3:6, diff=TRUE, fnam=FALSE )
ci.lin( mm, subset=3:6, diff=TRUE, fnam=TRUE )
ci.lin( mm, subset="f", diff=TRUE, fnam="f levels:" )
print( ci.lin( mm, subset="g", diff=TRUE, fnam="gee!:", vcov=TRUE ) )

# Use character defined subset to get ALL contrasts:
ci.lin( mm, subset="f", diff=TRUE )

[Package Epi version 1.0.12 Index]