R/mvnorm.skew.test.R

Defines functions mvnorm.skew.test

Documented in mvnorm.skew.test

### multinormal test based on skewness
### only assymptotic p-value returned
###
#' @export
mvnorm.skew.test <- function(X, na.action = na.fail)
    {
    DNAME<-deparse(substitute(X))

    X<-na.action(X)
    X<-as.matrix(X)

    n<-dim(X)[1]
    p<-dim(X)[2]

    T.1<-colMeans(X)
    T.2<-mean3(X)
    C.M<-cov(X)

    U.stat <- crossprod((T.1-T.2), solve(C.M)) %*% (T.1-T.2)
    chi.fac <- 2*(p+2)/(p^2)
    p.value <- 1-pchisq(n*U.stat/chi.fac,p)

    STATISTIC<-n*U.stat/chi.fac
    names(STATISTIC)<-"U"
    METHOD<-"Multivariate Normality Test Based on Skewness"

    PARAMETER<-c(p)
    names(PARAMETER)<-c("df")
    PVAL<-p.value
    res<-list(method=METHOD, statistic=STATISTIC, data.name=DNAME, parameter=PARAMETER, p.value=PVAL)
    class(res)<-"htest"
    return(res)

    }

Try the ICS package in your browser

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

ICS documentation built on Sept. 21, 2023, 9:07 a.m.