Implements percentile based bootstrapping to estimate the confidence intervals for the regression coefficients when doing linear regression for compositional outcomes and predictors

codalm_ci(
  y,
  x,
  accelerate = TRUE,
  nboot = 500,
  conf = 0.95,
  parallel = FALSE,
  ncpus = NULL,
  strategy = NULL,
  init.seed = 123
)

Arguments

y

A matrix of compositional outcomes. Each row is an observation, and must sum to 1. If any rows do not sum to 1, they will be renormalized

x

A matrix of compositional predictors. Each row is an observation, and must sum to 1. If any rows do not sum to 1, they will be renormalized

accelerate

A logical variable, indicating whether or not to use the Squarem algorithm for acceleration of the EM algorithm. Default is TRUE

nboot

The number of bootstrap repetitions to use. Default is 500

conf

A scalar between 0 and 1 containing the confidence level of the required intervals. Default is .95.

parallel

A logical variable, indicating whether or not to use a parallel operation for computing the permutation statistics

ncpus

Optional argument. When provided, is an integer giving the number of clusters to be used in parallelization. Defaults to the number of cores, minus 1.

strategy

Optional argument. When provided, this will be the evaluation function (or name of it) to use for parallel computation (if parallel = TRUE). Otherwise, if parallel = TRUE, then this will default to multisession. See plan.

init.seed

The initial seed for the permutations. Default is 123.

Value

A list, with ci_L and ci_U, giving the lower and upper bounds of each element of the B matrix

Examples

# \donttest{ require(ggtern) data("WhiteCells", package = 'ggtern') image <- subset(WhiteCells, Experiment == "ImageAnalysis") image_mat <- as.matrix(image[,c("G", "L", "M")]) microscopic <- subset(WhiteCells, Experiment == "MicroscopicInspection") microscopic_mat <- as.matrix(microscopic[,c("G", "L", "M")]) x <- image_mat / rowSums(image_mat) y <- microscopic_mat / rowSums(microscopic_mat) codalm_ci(y, x, nboot = 50, conf = .95)
#> $ci_L #> [,1] [,2] [,3] #> [1,] 9.576089e-01 0.01399186 1.156448e-03 #> [2,] 2.512029e-15 0.97220006 9.764192e-17 #> [3,] 6.197244e-21 0.01165546 9.145955e-01 #> #> $ci_U #> [,1] [,2] [,3] #> [1,] 9.837854e-01 0.03981767 4.560504e-03 #> [2,] 2.779953e-02 1.00000000 4.198096e-07 #> [3,] 3.143104e-06 0.08540455 9.868145e-01 #>
# }