Learn R Programming

RVAideMemoire (version 0.9-35)

fc.multcomp: Pairwise comparisons for the interaction between a factor and a covariate

Description

Perform pairwise comparisons between groups, based on a model, for one factor or the interaction between a factor and a covariate. The function is based on glht, so deals with any model accepted by this function.

Usage

fc.multcomp(model, term = NULL, mat = NULL, p.method = "fdr")

Arguments

model
any model accepted by glht.
term
character string giving the term on which comparisons are based (a factor or the interaction between a factor and a covariate).
mat
matrix of contrasts (see 'Details'), either a matrix or a data frame.
p.method
method for p-values correction. See help of p.adjust.

Value

  • methoda character string giving the name of the test computed.
  • modelmodel call.
  • p.valuetable of results.
  • p.adjust.methodmethod for p-values correction.

Details

In matrices of contrasts, each line is a comparison (= contrast) and each colum is a level of the factor. Rules for writing contrasts are: - levels not involved in the comparison must have a null value - levels to be compared must have opposite signs - levels can be grouped (for example 2 -1 -1 give a comparison of the first level against the group composed by the two others) - the sum of all values of a contrast must be null.

See Also

glht

Examples

Run this code
# 'kidney' dataset of package 'survival'
require(survival)
require(multcomp)

model <- coxph(Surv(time,status)~age*disease+factor(sex),data=kidney)

# Default: all pairwise comparisons
fc.multcomp(model,"disease")
fc.multcomp(model,"age:disease")

# Dunnett contrasts
n <- n <- 1:nlevels(kidney$disease)
names(n) <- levels(kidney$disease)
mat <- contrMat(n)
fc.multcomp(model,"disease",mat)

Run the code above in your browser using DataLab