knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

tcftt

The classical two-sample t-test only fits for the normal data. The tcfu() and tt() tests implemented in this package are suitable for testing the equality of two-sample means for the populations having unequal variances. When the populations are not normally distributed, these tests can provide more power than a large-sample t-test using normal approximation, especially when the sample sizes are moderate. The tcfu() uses the Cornish-Fisher expansion to achieve a better approximation to the true percentiles. The tt() transforms the Welch's t-statistic so that the sampling distribution become more symmetric. More technical details please refer to Zhang (2019) http://hdl.handle.net/2097/40235.

Installation

You can install the released version of tcftt from CRAN with:

install.packages("tcftt")

Example

This is a basic example which shows you how to solve a common problem:

library(tcftt)
x1 <- rnorm(20, 1, 3)
x2 <- rnorm(21, 2, 3)
tcfu(x1, x2, alternative = 'two.sided')
tt(x1, x2, alternative = 'less')

Main functions

The function tcfu() implements the Cornish-Fisher based two-sample test (TCFU) and tt() implements the transformation based two-sample test (TT).

The function t_edgeworth() provides the Edgeworth expansion of the cumulative density function for the Welch's t-statistic, and t_cornish_fisher() provides the Cornish-Fisher expansion for its percentiles.

The functions adjust_power() and pauc() provide power adjustment methods for simulation studies.



HuaiyuZhang/tcftt documentation built on July 9, 2023, 2:52 a.m.