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)

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 string this is matched against the parameter names (using grep) to find the subset.
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.
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?
alpha Significance level for the confidence intervals.

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.

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:" )
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 0.1 Index]