Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

gapstat

This function computes the gap statistic which is used to test for an outlier using Daniels method


Description

This function computes the gap statistic which is used to test for an outlier using Daniels method

Usage

gapstat(beta, pse)

Arguments

beta

input - vector of coefficients from saturated model fit to the data

pse

input - Lenth's PSE statistic calculated from the elements of beta

Value

returned gap statistic

Author(s)

John Lawson

Examples

## The function is currently defined as
function (beta, pse) 
{
    p <- length(beta)
    psehe <- pse
    sel <- beta >= 0
    betap <- beta[sel]
    betap <- sort(betap)
    betas <- betap[1]
    sel <- beta < 0
    betan <- beta[sel]
    nn <- length(betan)
    betan <- sort(betan)
    betal <- betan[nn]
    zl <- qnorm((nn - 0.375)/(p + 0.25))
    zs <- qnorm((nn + 1 - 0.375)/(p + 0.25))
    gap <- ((betas - betal)/psehe)/(zs - zl)
    return(gap)
  }

daewr

Design and Analysis of Experiments with R

v1.2-7
GPL-2
Authors
John Lawson [aut, cre], Gerhard Krennrich [aut]
Initial release
2021-2-18

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.