simplesimint {BSagri} | R Documentation |
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
simplesimint(coef, vcov, cmat, df = NULL, conf.level = 0.95, alternative = c("two.sided", "less", "greater"))
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 |
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.
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 |
This is a testversion and has not been checked extensively. Please report bugs.
Frank Schaarschmidt
See ?coef
and ?vcov
for extracting of parameter vectors and corresponding variance covariance matrices from variou model fits.
# 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