mmcm.resamp {mmcm} | R Documentation |
This function gives P-value for the modified maximum contrast statistics by using a resampling based procedure.
mmcm.resamp( x, g, contrast, nsample = 20000, seed = unclass(Sys.time()) )
x |
a numeric vector of data values |
g |
a integer vector giving the group for the corresponding elements of x |
contrast |
a numeric coefficient matrix for the modified maximum contrast statistics |
nsample |
specifies the number of resamples (defalt: 20,000) |
seed |
a 32-bit integer (-2^31+1 <= seed <= 2^31-1) used as the seed for the pseudo-random number generator used for resampling (default: time-dependent integer) |
mmcm.resamp
performs the modified maximum contrast method that is
detecting a true response pattern when unbalanced sample size.
Y_ij (i = 1, 2, ...; j = 1, 2, ..., n_i) is an observed response for jth individual in ith group.
C is coefficient matrix for the modified maximum contrast statistics (i x k matrix, i: No. of groups, k: No. of pattern).
C = (c_1 c_2 ... c_k)
c_k is coefficient vector of kth pattern.
c_k = (c_k1 c_k2 ... c_ki)^t (sum from i of c_ki = 0)
T'_max is the modified maximum contrast statistics.
Ybar_i = (sum from j of Y_ij) / n_i, Ybar = (Ybar_1 Ybar_2 ... Ybar_i)^t (i x 1 vector), T'_k = c_k^t Ybar / c_k^t c_k
T'_max = max(T'_1, T'_2, ..., T'_k)
Consider testing the overall null hypothesis H_0: μ_1=μ_2=...=μ_i, versus alternative hypotheses H_1 for response petterns (H_1: μ_1<μ_2<...<μ_i,~ μ_1=μ_2<...<μ_i,~ μ_1<μ_2<...=μ_i). The P-value for the probability distribution of T'_max under the overall null hypothesis is
P-value = Pr(T'_max > t*_max | H0)
t*_max is observed value of statistics. This function gives distribution of T'_max by using a resampling based procedure.
cont |
suffix of coefficient vector of kth pattern that gives the maximum contrast statistics (colmun number of coefficient matrix). |
pval |
P-value of the modified maximum contrast statistics, which is simulated by using a resampling based procedure. |
apval |
vector of P-values (Pr(T'_max > t*_max | H0) for each modified contrast statistics. |
astat |
vector of observed values (T'_k) for each modified contrast statistics. |
acont |
coefficient matrix (copy of argument). |
return value is mmcm.resamp
class object.
Author: Kengo NAGASHIMA and Yasunori SATO
Maintainer: Kengo NAGASHIMA nagasima@josai.ac.jp
Sato, Y., Laird, N.M., Nagashima, K., et al. (2009) A new statistical screening approach for finding pharmacokinetics-related genes in genome-wide studies. Pharmacogenomics J., in press. http://www.ncbi.nlm.nih.gov/pubmed/19104505
## Example 1 ## # true response pattern: dominant model c=(1, 1, -2) set.seed(326584) x <- c( rlnorm(130, meanlog = 0.91, sdlog = 0.1), rlnorm( 90, meanlog = 0.91, sdlog = 0.1), rlnorm( 10, meanlog = 0.85, sdlog = 0.25) ) 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 <- cbind( c(-1, 0, 1), c(-2, 1, 1), c(-1, -1, 2) ) y <- mmcm.resamp(x, g, contrast, 20000, 5784324) 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(8415849) x <- c( rlnorm(130, meanlog = 0.91, sdlog = 0.1), rlnorm( 90, meanlog = 0.91, sdlog = 0.1), rlnorm( 10, meanlog = 0.85, sdlog = 0.25), rlnorm(130, meanlog = 0.79, sdlog = 0.1), rlnorm( 90, meanlog = 0.85, sdlog = 0.1), rlnorm( 10, meanlog = 0.91, sdlog = 0.25), rlnorm(130, meanlog = 0.85, sdlog = 0.1), rlnorm( 90, meanlog = 0.91, sdlog = 0.1), rlnorm( 10, meanlog = 0.91, sdlog = 0.25) ) 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 <- cbind( c(-1, 0, 1), c(-2, 1, 1), c(-1, -1, 2) ) mmcmtapply <- function(r) { mmcm.resamp( xx$x[xx$pos==r[1]], xx$g[xx$pos==r[1]], contrast, 10000, 5784324+as.numeric(r[1]) ) } y <- tapply(xx$pos, xx$pos, mmcmtapply) yy <- data.frame( Pos = as.vector(names(y)), Pval = as.vector(sapply(y, "[[", 5)), Pattern = as.vector(sapply(y, "[[", 6)) ) yy