R/boot_f_pcor.R

Defines functions boot_f_pcor

Documented in boot_f_pcor

#' boot_f_pcor
#'
#' Generate R bootstrap replicates of a statistic applied to data.
#'
#' @param data A vector, matrix, or data frame containing the input data.
#' If a matrix or data frame is provided, each row is treated as a separate
#' multivariate observation.
#' @param indices A numeric or integer vector specifying the indices to be
#' utilized in the calculation. These indices determine which elements or rows
#' of the 'data' are to be included in the analysis
#' @param cor.type A string specifying the method of correlation to be applied
#' in the bootstrap procedure. Available options are "pearson" (default),
#' "kendall", or "spearman".
#'
#' @return A matrix with bootstrapped estimates of partial correlation coefficients
#'
#' @references https://www.datacamp.com/community/tutorials/bootstrap-r
#' @keywords internal
#'
boot_f_pcor <- function(data, indices, cor.type){

    partial.r(data=data[indices,], x=c("x","y"), y="z", use= "pairwise" , method = cor.type)[2]

  }
jernejjevsenak/dendroTools documentation built on Feb. 2, 2024, 7:13 p.m.