mcm.mvt {mmcm} | R Documentation |
The maximum contrast method by using the randomized quasi-Monte Carlo method
Description
This function gives P
-value for the maximum contrast statistics by using
randomized quasi-Monte Carlo method from pmvt
function of package mvtnorm
.
Usage
mcm.mvt(
x,
g,
contrast,
alternative = c("two.sided", "less", "greater"),
algorithm = GenzBretz()
)
Arguments
x |
a numeric vector of data values |
g |
a integer vector giving the group for the corresponding elements of x |
contrast |
a numeric contrast coefficient matrix for the maximum contrast statistics |
alternative |
a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". You can specify just the initial letter. |
algorithm |
an object of class |
Details
mcm.mvt
performs the maximum contrast method that is detecting
a true response pattern.
Y_{ij} (i=1, 2, \ldots; j=1, 2, \ldots, n_i)
is an observed response for j
-th individual in
i
-th group.
\bm{C}
is coefficient matrix for the maximum contrast statistics
(i \times k
matrix, i
: No. of groups, k
: No. of pattern).
\bm{C}=(\bm{c}_1, \bm{c}_2, \ldots, \bm{c}_k)^{\rm{T}}
\bm{c}_k
is coefficient vector of k
th pattern.
\bm{c}_k=(c_{k1}, c_{k2}, \ldots, c_{ki})^{\rm{T}} \qquad (\textstyle \sum_i c_{ki}=0)
T_{\max}
is the maximum contrast statistic.
\bar{Y}_i=\frac{\sum_{j=1}^{n_i} Y_{ij}}{n_{i}},
\bar{\bm{Y}}=(\bar{Y}_1, \bar{Y}_2, \ldots, \bar{Y}_i, \ldots, \bar{Y}_a)^{\rm{T}},
\bm{D}=diag(n_1, n_2, \ldots, n_i, \ldots, n_a),
V=\frac{1}{\gamma}\sum_{j=1}^{n_i}\sum_{i=1}^{a} (Y_{ij}-\bar{Y}_i)^2,
\gamma=\sum_{i=1}^{a} (n_i-1),
T_{k}=\frac{\bm{c}^t_k \bar{\bm{Y}}}{\sqrt{V\bm{c}^t_k \bm{D} \bm{c}_k}},
T_{\max}=\max(T_1, T_2, \ldots, T_k).
Consider testing the overall null hypothesis H_0: \mu_1=\mu_2=\ldots=\mu_i
,
versus alternative hypotheses H_1
for response petterns
(H_1: \mu_1<\mu_2<\ldots<\mu_i,~ \mu_1=\mu_2<\ldots<\mu_i,~
\mu_1<\mu_2<\ldots=\mu_i
).
The P
-value for the probability distribution of T_{\max}
under the overall null hypothesis is
P\mbox{-value}=\Pr(T_{\max}>t_{\max} \mid H_0)
t_{\max}
is observed value of statistics.
This function gives distribution of T_{\max}
by using randomized
quasi-Monte Carlo method from package mvtnorm
.
Value
statistic |
the value of the test statistic with a name describing it. |
p.value |
the p-value for the test. |
alternative |
a character string describing the alternative hypothesis. |
method |
the type of test applied. |
contrast |
a character string giving the names of the data. |
contrast.index |
a suffix of coefficient vector of the |
error |
estimated absolute error and, |
msg |
status messages. |
References
Yoshimura, I., Wakana, A., Hamada, C. (1997). A performance comparison of maximum contrast methods to detect dose dependency. Drug Information J. 31: 423–432.
See Also
Examples
## Example 1 ##
# true response pattern: dominant model c=(1, 1, -2)
set.seed(136885)
x <- c(
rnorm(130, mean = 1 / 6, sd = 1),
rnorm( 90, mean = 1 / 6, sd = 1),
rnorm( 10, mean = -2 / 6, sd = 1)
)
g <- rep(1:3, c(130, 90, 10))
boxplot(
x ~ g,
width = c(length(g[g==1]), length(g[g==2]), length(g[g==3])),
main = "Dominant model (sample data)",
xlab = "Genotype",
ylab = "PK parameter"
)
# coefficient matrix
# c_1: additive, c_2: recessive, c_3: dominant
contrast <- rbind(
c(-1, 0, 1), c(-2, 1, 1), c(-1, -1, 2)
)
y <- mcm.mvt(x, g, contrast)
y
## Example 2 ##
# for dataframe
# true response pattern:
# pos = 1 dominant model c=( 1, 1, -2)
# 2 additive model c=(-1, 0, 1)
# 3 recessive model c=( 2, -1, -1)
set.seed(3872435)
x <- c(
rnorm(130, mean = 1 / 6, sd = 1),
rnorm( 90, mean = 1 / 6, sd = 1),
rnorm( 10, mean = -2 / 6, sd = 1),
rnorm(130, mean = -1 / 4, sd = 1),
rnorm( 90, mean = 0 / 4, sd = 1),
rnorm( 10, mean = 1 / 4, sd = 1),
rnorm(130, mean = 2 / 6, sd = 1),
rnorm( 90, mean = -1 / 6, sd = 1),
rnorm( 10, mean = -1 / 6, sd = 1)
)
g <- rep(rep(1:3, c(130, 90, 10)), 3)
pos <- rep(c("rsXXXX", "rsYYYY", "rsZZZZ"), each=230)
xx <- data.frame(pos = pos, x = x, g = g)
# coefficient matrix
# c_1: additive, c_2: recessive, c_3: dominant
contrast <- rbind(
c(-1, 0, 1), c(-2, 1, 1), c(-1, -1, 2)
)
y <- by(xx, xx$pos, function(x) mmcm.mvt(x$x, x$g,
contrast))
y <- do.call(rbind, y)[,c(3,7,9)]
# miss-detection!
y