# Re: [S] S code for Tolerance Intervals ?

Robert Kinley (KINLEY_ROBERT@lilly.com)
Thu, 15 Oct 1998 17:52:18 +0100

I thought the list would like to know the results of my enquiry (original
message attached).

It wouldn't be hard to write a function to get approximate intervals, but to
get exact intervals
you need a function for quantiles of the non-central t distribution.

I tried creating a function to get quantiles of the non-central F (see below)
, in hopes of using
the non-central analogue of the fact that sqrt ( F[1,n] ) = t[n] , however
it eventually dawned on
me that this only gives you a symmetric region around zero, not a true
quantile. I can't see
a way of using this to get what I want ........ any ideas ??

The way forward seems to be to write a C function (maybe converting the
Fortran algorithm
of Owen) and to call this from S.

Pleasant though this would be, I don't have the time and since all the
non-centrals and their
inverses are available in SAS, I might as well use those. Pity.

Thanks to those who replied pointing me in the right direction.

Bob Kinley ............ rdk@lilly.com
________________________________________________________________________

rudimentary function for quantiles of the non-central F :-

function(prob, degsf1, degsf2, ncparam = 0, lims = c(0, 10))
{
f <- function(q, p, df1, df2, ncp = 0)
{
ans <- pf(q, df1, df2, ncp) - p
ans
}
ans <- uniroot(f, interval = lims, p = prob, df1 = degsf1, df2 = degsf2,
ncp = ncparam)
ans\$root
}

___________________________________________________________________________

Robert Kinley <KINLEY_ROBERT@lilly.com> on 12/10/98 10:53:21

To: s-news@wubios.wustl.edu
cc:

Subject: [S] S code for Tolerance Intervals ?

Before I reinvent any wheels, can anyone point me at some S code to calculate
beta-content tolerance intervals for the Normal distribution.

That is, to calculate k such that, given Beta and Gamma, Xbar and s (and n),
then
Pr. [ Pr. ( Xbar - ks < X < Xbar + ks) >= Beta ] >= Gamma

thanks ........... Bob Kinley........... rdk@lilly.com

-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news

-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news