kfuns1: 'k()' functions for Edgeworth expansions - one-sample

kfuns1R Documentation

k() functions for Edgeworth expansions - one-sample

Description

Calculate k's (cumulant components) for a general version of Edgeworth expansions (EE) for one-sample t-statistic.

Usage

K12one(A, B, mu2, mu3, mu4, mu5, mu6)

K13one(A, B, mu2, mu3, mu4, mu5, mu6)

K21one(A, B, mu2, mu3, mu4, mu5, mu6)

K22one(A, B, mu2, mu3, mu4, mu5, mu6)

K23one(A, B, mu2, mu3, mu4, mu5, mu6)

K31one(A, B, mu2, mu3, mu4, mu5, mu6)

K32one(A, B, mu2, mu3, mu4, mu5, mu6)

K41one(A, B, mu2, mu3, mu4, mu5, mu6)

K42one(A, B, mu2, mu3, mu4, mu5, mu6)

K51one(A, B, mu2, mu3, mu4, mu5, mu6)

K61one(A, B, mu2, mu3, mu4, mu5, mu6)

Arguments

A

value of A (depends on the type of the test).

B

value of B (depends on the type of the test).

mu2, mu3, mu4, mu5, mu6

central moments (2 - 6) or their estimates.

Details

Variance adjustment r^2 is equal to the output of K21one(), unless different variance estimates are used for A, numerator of k, and r.

Value

A calculated value for the respective component.

See Also

Other k() functions: kfuns2

Examples

# moderated t-statistic
if (requireNamespace("limma")) {
  # simulate high-dimensional data
  n <- 10
  m  <- 1e4          # number of tests
  ns <- 0.05*m       # number of significant features
  dat <- matrix(rgamma(m*n, shape = 3) - 3, nrow = m)
  shifts <- runif(ns, 1, 5)
  dat[1:ns, ] <- dat[1:ns, ] - shifts
  # estimate prior information
  fit <- limma::lmFit(dat, rep(1, n))
  fbay <- limma::eBayes(fit)
  # look at one feature (row of data)
  i <- 625
  stats <- smpStats(dat[i, ], moder = TRUE, d0 = fbay$df.prior, 
                    s20 = fbay$s2.prior, varpost = fbay$s2.post[i])
  vars <- names(stats)  # if want to remove carryover names
  names(stats) <- NULL                   
  for (j in 1:length(stats)) {
    assign(vars[j], stats[j])
  }
  K32one(A, B, mu2, mu3, mu4, mu5, mu6)
}

innager/edgee documentation built on April 24, 2024, 8:14 p.m.