View source: R/data_driven_lambda.R
lambda.adaptive.enlarge | R Documentation |
\lambda
in a data-driven way.Iteratively enlarge a tuning parameter \lambda
to enhance the power of hypothesis testing.
The iterative algorithm ends when an enlarged \lambda
unlikely yields the first order stability.
lambda.adaptive.enlarge(
lambda,
scaled.difference.matrix,
sample.mean = NULL,
mult.factor = 2,
verbose = FALSE,
seed = NULL,
...
)
lambda |
The real-valued tuning parameter for exponential weightings (the calculation of softmin). |
scaled.difference.matrix |
A n by (p-1) difference scaled.difference.matrix matrix after column-wise scaling (reference dimension - the rest); each of its row is a (p-1)-dimensional vector of differences. |
sample.mean |
The sample mean of the n samples in scaled.difference.matrix; defaults to NULL. It can be calculated via colMeans(scaled.difference.matrix). If your experiment involves hypothesis testing over more than one dimension, pass sample.mean=colMeans(scaled.difference.matrix) to speed up computation. |
mult.factor |
In each iteration, |
verbose |
A boolean value indicating if the number of iterations should be printed to console; defaults to FALSE. |
seed |
(Optional) If provided, used to seed for tie-breaking (for reproducibility). |
... |
Additional arguments to is.lambda.feasible.LOO. |
A list containing:
lambda | The final (enlarged) lambda that is still feasible. |
capped | Logical, TRUE if the enlargement was capped due to reaching the threshold. |
residual.slepian | Residual value from the feasibility check at the final lambda. |
variance.bound | Variance bound used in the final feasibility check. |
# Simulate data
set.seed(123)
r <- 4
n <- 200
mu <- (1:20)/20
cov <- diag(length(mu))
set.seed(108)
data <- MASS::mvrnorm(n, mu, cov)
sample.mean <- colMeans(data)
diff.mat <- get.difference.matrix(data, r)
sample.mean.r <- get.sample.mean.r(sample.mean, r)
lambda <- lambda.adaptive.LOO(diff.mat, sample.mean=sample.mean.r)
# Run the enlargement algorithm
res <- lambda.adaptive.enlarge(lambda, diff.mat, sample.mean=sample.mean.r)
res
# with a seed
res <- lambda.adaptive.enlarge(lambda, diff.mat, sample.mean=sample.mean.r, seed=3)
res
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.