multcomp2table: Gather P-values and Confidence Intervals in a Table.

View source: R/multcomp2table.R

multcomp2tableR Documentation

Gather P-values and Confidence Intervals in a Table.

Description

Gather p-values and confidence intervals in a table.

Usage

multcomp2table(
  object,
  link,
  transform = function(x) {
     x
 },
  seed = NULL,
  method.glht = "glht",
  conf.level = 0.95,
  method.multcomp = NULL,
  digits = 3,
  digits.p.value = 3,
  ...
)

Arguments

object

a fitted model.

link

[character vector] null hypotheses or coefficients to be tested.

transform

[function] function to backtransform the estimates and the associated confidence intervals.

seed

[integer] if not NULL, integer used to initialize the random number generator. See set.seed for details.

method.glht

[character or function] function used to extract the coefficients and variance-covariance matrix from the object. Recommanded: "glht" from the multcomp package or "glht2" from the lavaSearch2 package.

conf.level

[numeric, 0-1] Confidence level of the interval.

method.multcomp

[character] the method used to adjust the p-value and confidence intervals (CIs) for multiplicity. Note that simultaneous CIs are available only for method.multcomp="none", method.multcomp="bonferroni", and method.multcomp"single-step".

digits

[integer] if not NULL, the number of decimal places used for the estimate and the associated confidence intervals.

digits.p.value

[integer] if not NULL, the number of decimal places used for the p-values.

...

arguments passed to method.glht.

Examples

if(require(multcomp)){

m <- lvm(Y~X1+X2)
d <- sim(m, n = 100)

## lm object
e.lm <- lm(Y~X1+X2, data = d)
multcomp2table(e.lm, link = c("X1=0","X2=1"))
multcomp2table(e.lm, link = c("X1=0"))

## gls object
if(require(nlme)){
e.gls <- gls(Y~X1+X2, data = d)
multcomp2table(e.gls, link = c("X1=0","X2=1"))
multcomp2table(e.gls, link = c("X1=0"))
}

## lvm object
if(require(lava) & require(lavaSearch2)){
e.lvm <- estimate(m, data = d)
multcomp2table(e.lvm, method.glht = "glht2", link = c("Y~X1"))
multcomp2table(e.lvm, method.glht = "glht2", link = c("Y~X1","Y~X2"))
multcomp2table(e.lvm, method.glht = "glht2", link = c("Y~X1","Y~X2"), rhs = c(1,1))
}

}

bozenne/butils documentation built on Oct. 14, 2023, 6:19 a.m.