Learn R Programming

mcprofile (version 0.1-2)

mcpcalc: Construction of Multiple Contrast Profiles

Description

Calculates signed root deviance profiles given a glm or lm object. The profiled parameters of interest are defined by providing a contrast matrix.

Usage

mcpcalc(object, CM, control = mcprofileControl(), margin = NULL, mc.cores=1)
## S3 method for class 'lm':
mcpcalc(object, CM, control=mcprofileControl(), margin=NULL, mc.cores=1)
## S3 method for class 'glm':
mcpcalc(object, CM, control=mcprofileControl(), margin=NULL, mc.cores=1)

Arguments

object
An object of class glm or lm
CM
A contrast matrix for the definition of parameter linear combinations (CM %*% coefficients(object)). The number of columns should be equal to the number of estimated parameters. Providing row names is recommendable.
control
A list with control arguments. See mcprofileControl.
margin
Numeric vector of margins, defining the profiling range with stepsize defined in the steps slot of the control argument list in mcprofileControl. If NULL no extra margin is cons
mc.cores
Number of cores using package parallel for parallelization.

Value

  • An object of class mcprofile. The slot srdp contains the profiled signed root deviance statistics.

Details

The profiles are calculates separately for each row of the contrast matrix. With single non-zero entries in a contrast matrix, the glm.fit function is used for optimization. With two non-zero entries in a contrast, one-dimensional optimization is performed by optimize for the second non-zero contrast parameter conditional on the parameter linear combination and all other nuisance parameters. For all higher dimensional optimization problems, the BFGS method in optim is used.

See Also

profile.glm, glht, contrMat, confint.mcprofile, summary.mcprofile

Examples

Run this code
#######################################
## cell transformation assay example ##
#######################################

str(cta)
boxplot(foci ~ conc, cta, xlab="concentration", col="lightgreen")
## change class of cta$concentration into factor
cta$concf <- factor(cta$conc, levels=unique(cta$conc))

# glm fit assuming a Poisson distribution for foci counts
# parameter estimation on the log link
# estimating marginal means by removing the intercept
fm <- glm(foci ~ concf-1, data=cta, poisson(link="log"))

### Comparing each dose to the control by Dunnett-type comparisons
# Constructing contrast matrix
CM <- contrMat(table(cta$concf), type="Dunnett")

# calculating signed root deviance profiles
(dmcp <- mcpcalc(fm, CM))
# plot profiles
plot(dmcp)
# confidence intervals
(ci <- confint(dmcp))
plot(ci)

Run the code above in your browser using DataLab