R/transang.R

Defines functions transangph

Documented in transangph

#' TRANSFORMATION ANGULAIRE
#' Calcul des bornes sup et inf d'un intervalle de confiance par transformation angulaire.
#' @param vv  nb evenement
#' @param ld taille echantillon
#' @param pc percent of IC (95 by default)
#'
#' @return lit =  nb/tot (percent) [binf ; bsup],
#'         litx = nb/tot (percent) & [binf ; bsup],
#'         binf, bsup
#'
#' @examples transangph(vv = 55, ld = 100, pc = 95)
#'
#' @export
transangph <- function(vv, ld, pc = 95){
  pp <- vv/ld
  sp <- 1.959/(2*sqrt(ld))
  pinf <- sin(asin(sqrt(pp-1/(2*ld)))-sp)^2*100
  psup <- sin(asin(sqrt(pp+1/(2*ld)))+sp)^2*100
  nb1 <- paste0(vv,"/",ld," (",signif(pp*100,2)," \\%)")
  nb2 <- paste0(" [",signif(pinf,2)," ; ",signif(psup,2),"]")
  nbx <- paste0(nb1,nb2)
  nby <- c(nb1,nb2)
  return(list(binf = pinf, bsup = psup, lit = nbx,litx = nby))
}
philippemichel/thesisph documentation built on Dec. 22, 2020, 11:08 a.m.