p_mauchly.test: p-value from Mauchly's Test of Sphericity simulation

View source: R/p_mauchly.test.R

p_mauchly.testR Documentation

p-value from Mauchly's Test of Sphericity simulation

Description

Perform simulation experiment for Mauchly's Test of Sphericity using the function mauchlys.test, returning a p-value. Assumes the data are from a multivariate normal distribution, however this can be modified.

Usage

p_mauchly.test(n, sigma, gen_fun = gen_mauchly.test, ...)

gen_mauchly.test(n, sigma, ...)

mauchlys.test(X)

Arguments

n

sample size

sigma

symmetric covariance/correlation matrix passed to gen_fun

gen_fun

function used to generate the required data. Object returned must be a matrix with K columns and n rows. Default uses gen_mauchly.test to generate multivariate normal samples. User defined version of this function must include the argument ...

...

additional arguments to be passed to gen_fun. Not used unless a customized gen_fun is defined

X

a matrix with k columns and n rows

Value

a single p-value

Author(s)

Phil Chalmers rphilip.chalmers@gmail.com

Examples


sigma <- diag(c(1,2,1))
sigma

p_mauchly.test(100, sigma=sigma)

# Null is true
sigma.H0 <- diag(3)
p_mauchly.test(100, sigma=sigma.H0)



    # empirical power estimate
    p_mauchly.test(100, sigma=sigma) |> Spower()

    # empirical Type I error estimate
    p_mauchly.test(100, sigma=sigma.H0) |> Spower()



Spower documentation built on April 4, 2025, 5:11 a.m.