Learn R Programming

mratios (version 1.4.2)

mcpqrci: Simultaneous confidence intervals for contrasts of quantiles

Description

The following functions construct simultaneous confidence intervals for multiple constrasts of quantiles (for ratios and differences) in a one-way layout. The "mcpqrci" is for ratios and "mcpqdci" is for differences of quantiles. Both functions have also options for right censored data.

Usage

mcpqrci(y, f, event = NULL, Right.Censored = FALSE,
p = 0.5, conf.level = 0.95, type = "Dunnett",
base = 1, Num.cmat = NULL, Den.cmat = NULL,
method = c("Wald", "Fieller"), ...)

mcpqdci(y, f, event = NULL, Right.Censored = FALSE, p = 0.5, conf.level = 0.95, type = "Dunnett", base = 1 , cmat = NULL,...)

Arguments

y

a numeric vector, the response variable. If Right.Censored = TRUE, y is non-negative follow up time for right censored in survival data.

f

a factor variable of the same length as y, assigning the observations in y into k groups.

event

a binary variable indicating status for right censored data. Usually, 1 if event of interest has occurred (death = 1) and 0 otherwise (alive = 0); (optional: only if y is survival data).

Right.Censored

a logical expression indicating right-censored data is being used for constructing simultaneous confidence intervals, (optional: only if y is survival data).

p

a single numeric value between 0 and 1 indicating the level of quantile for the contrasts. The default is p = 0.5 (the median).

conf.level

a single numeric value between 0 and 1 indicating the level of confidence interval.

type

a single character string, naming a contrast type, see contrMat and contrMatRatio, for the options; this argument is ignored if a contrast matrix is specified in cmat or Num.cmat and Den.cmat.

base

a positive integer specifying the control group for the Dunnett contrasts, ignored otherwise. When base is not given the first group in terms of an alphanumeric order is taken as the control group.

cmat

(optional) a matrix with numeric entries, containing contrast coefficients defining differences of quantiles in function mcpqdci; if there are k levels in f, the matrix should have k columns. type is ignored if cmat is specified

Num.cmat

(optional) Numerator contrast matrix for ratios of quantiles in function mcpqrci, where the columns correspond to k groups and rows correspond to m contrasts.

Den.cmat

(optional) Denominator contrast matrix for ratios of quantiles in function mcpqrci, where the columns correspond to k groups and rows correspond to m contrasts. type is ignored if Den.cmat and Den.cmat is specified.

method

a single character string, naming the method by which to compute the confidence intervals for ratios of quantiles. Default is "Wald". Note if the calculated lower confidence limit is negative and the ratio cannot be negative, set the lower confidence limit to zero.

further arguments to be passed to the internal methods, in particular: dist must be a single character string invoking the use of multivariate normal quantiles; dist="MVN" or multivariate normal quantiles; dist="MVT". bw.selec is a single character string specifying the method of bandwidth selection when using right censored survival data; bw.selec = "plug-in".

Value

a list with elements

cmat

Matrix of contrast used for contrast differences.

Num.Contrast

Matrix of contrast used for the numerator of ratios.

Den.Contrast

Matrix of contrast used for the denominator of ratios.

conf.level

A numeric value, as input.

estimate

a column vector, containing the point estimates of the contrasts.

std.err

a column vector, containing the standard error of the contrast estimates.

conf.int

a Mx2 matrix of confidence bounds, if M comparisons among the K samples are invoked.

Details

The interest is to construct simultaneous confidence intervals for several contrast of quantiles in a one-way layout. An asymptotic approach is used in estimating the variance of estimated quantiles. The mcpqrci handles ratios of multiple contrasts of quantiles and mcpqdci handles differences of multiple contrast of quantiles.

If event argument is provided and Right.Censored = TRUE, the functions computes simultaneous confidence intervals for right censored data in y. The type argument defines the type of contrast matrix to use. Users can also define a preferred contrast matrix, cmat.

See Also

sciratio for simultaneous confidence intervals for ratios of linear combinations of means

Examples

Run this code
# NOT RUN {
data("DiabeticMice")
response <- DiabeticMice$response
group <- DiabeticMice$group
## Example 1
Num.cmat <- matrix(c(1,1,0,0,0,1,0,0,0),3)
Den.cmat <- matrix(c(0,0,0,1,0,0,0,1,1),3)
mcpqdci(y = response, f = group, cmat = (Num.cmat + -1*Den.cmat))
mcpqdci(y = response, f = group, cmat = (Num.cmat + -1*Den.cmat)[-1,])
mcpqrci(y = response, f = group, Num.cmat = Num.cmat, Den.cmat = Den.cmat )
mcpqrci(y = response, f = group, Num.cmat = Num.cmat[-1,], Den.cmat = Den.cmat[-1,] )


## Example 2 

data("bnct")
mcpqrci(y = bnct$time, f = bnct$trt, event = bnct$death, Right.Censored=TRUE)

## Sampled data:

y <- c(rnorm(20),rnorm(16,3),rnorm(24,7,2))
f <- rep(paste0("group", 1:3), c(20,16, 24))
event <- rbinom(60,1,0.8)

mcpqdci(y=y, f=f, method = "Fieller", base = 3)

mcpqrci(y=abs(y), f=f, event=event, Right.Censored=TRUE,
Num.cmat = cbind(c(1,1), 0*diag(2)),
Den.cmat = cbind(c(0,0), diag(2)))

cmat <- cbind(-c(1,1),diag(2))
mcpqdci(y=y, f=f, method = "Fieller", cmat = cmat)
# }

Run the code above in your browser using DataLab