Simultaneous confidence intervals from raw estimates

Share:

Description

Calculates simultaneous confidence intervals for multiple contrasts based on a parameter vector, its variance-covariance matrix and (optionally) the degrees of freedom, using quantiles of the multivar

Usage

1
2
simplesimint(coef, vcov, cmat, df = NULL, conf.level = 0.95,
 alternative = c("two.sided", "less", "greater"))

Arguments

coef

a single numeric vector, specifying the point estimates of the parameters of interest

vcov

the variance-covariance matrix corresponding to coef, should be of dimension P-times-P, when coef is of P

cmat

the contrasts matrix specifying the comparisons of interest with respect to coef, should have P columns, when coef is of length p

df

optional, the degree of freedom for the multivariate t-distribution; if specified, quantiles from the multivariate t-distribution are used for confidence interval estimation, if not specified (default), quantiles of the multivariate normal distribution are used

conf.level

a single numeric value between 0.5 and 1.0; the simultaneous confidence level

alternative

a single character string, "two.sided" for intervals, "less" for upper limits, and "greater" for lower limits

Details

Implements the methods formerly available in package multcomp, function csimint. Input values are a vector of parameter estimates mu of length P, a corresponding estimate for its variance-covariance matrix Sigma (P times P), and a contrast matrix C of dimension M times P. The contrasts L = C * mu are computed, the variance-covariance matrix (being a function of C and Sigma) and the corresponding correlation matrix R are computed. Finally, confidence intervals for L are computed: if df is given, quantiles of an M-dimensional t distribution with correlation matrix R are used, otherwise quantiles of an M-dimensional standard normal distribution with correlation matrix R are used.

Value

An object of class "simplesimint"

estimate

the estimates of the contrasts

lower

the lower confidence limits

upper

the upper confidence limits

cmat

the contrast matrix, as input

alternative

a character string, as input

conf.level

a numeric value, as input

quantile

a numeric value, the quantile used for confidence interval estimation

df

a numeric value or NULL, as input

stderr

the standard error of the contrasts

vcovC

the variance covariance matrix of the contrasts

Note

This is a testversion and has not been checked extensively.

Author(s)

Frank Schaarschmidt

See Also

See ?coef and ?vcov for extracting of parameter vectors and corresponding variance covariance matrices from various model fits.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# For the simple case of Gaussian response
# variables with homoscedastic variance,
# see the following example


library(mratios)
data(angina)

boxplot(response ~ dose, data=angina)

# Fit a cell means model,

fit<-lm(response ~ 0+dose, data=angina)

# extract cell means, the corresponding
# variance-covariance matrix and the
# residual degree of freedom,

cofi<-coef(fit)
vcofi<-vcov(fit)
dofi<-fit$df.residual

# define an appropriate contrast matrix,
# here, comparisons to control

n<-unlist(lapply(split(angina$response, f=angina$dose), length))
names(n)<-names(cofi)

cmat<-contrMat(n=n, type="Dunnett")
cmat

#

test<-simplesimint(coef=cofi, vcov=vcofi, df=dofi, cmat=cmat, alternative="greater" )

test

summary(test)

plotCI(test)

### Note, that the same result can be achieved much more conveniently
### using confint.glht in package multcomp

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.