R/confInt.boxcoxmeta.R

Defines functions confInt.boxcoxmeta

Documented in confInt.boxcoxmeta

confInt.boxcoxmeta<- function(x, level = 0.95, verbose = TRUE,...){


if ((level<=0)|(level>=1)) stop("Confidence level must be between 0 and 1")
if (all(x$result$P.Value<=x$alpha)) stop(paste("Transformed data must be normally distributed at alpha = ",x$alpha,sep = ""))




meantf <- mean(x$tf.data)
lowertf <- mean(x$tf.data)-qt((1-level)/2,df = (length(x$tf.data)-1),lower.tail = FALSE)*sd(x$tf.data)/sqrt(length(x$tf.data))
uppertf <- mean(x$tf.data)+qt((1-level)/2,df = (length(x$tf.data)-1),lower.tail = FALSE)*sd(x$tf.data)/sqrt(length(x$tf.data))
vectf <- c(meantf, lowertf, uppertf)
if (x$lambda.hat != 0) vecbt <- (vectf*x$lambda.hat+1)^(1/x$lambda.hat)
if (x$lambda.hat == 0) vecbt <- exp(vectf)



vecbt<- vecbt-x$lambda2
vecbt<- matrix(vecbt,1,3)
colnames(vecbt)<-c("Mean", paste((1-level)/2*100, "%",sep = ""), paste((1-(1-level)/2)*100, "%",sep = ""))
rownames(vecbt)<-x$var.name

     if (verbose){
        cat("\n"," Back transformed data", "\n", sep = " ")
        cat("---------------------------------------------", "\n", sep = " ")
        print(vecbt)
        cat("---------------------------------------------", "\n\n", sep = " ")
      }

invisible(vecbt)
}

Try the AID package in your browser

Any scripts or data that you put into this service are public.

AID documentation built on Sept. 13, 2023, 5:07 p.m.