BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
djgetty
Calcite | Level 5

I need to determine the minimum sample size/create a power curve for computing a 95%-95% upper tolerance limit. I see that proc power has functionality for many power computations but not for tolerance intervals.  From what I have investigated thus far, I would need to set up monte carlo simulations to create the power curve. Is there an easier way? Minitab and other packages have this functionality through menu driven platforms so I am hoping that with the inclusiveness of SAS procedures there is a way to perform this task.

 

Any advice would be appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

Hello @djgetty and welcome to the SAS Support Communities!

 

Looking at the formulas in the Minitab® 20 documentation Methods and formulas for Sample Size for Tolerance Intervals, I think you can compute the sample size in a DATA step. You can also define a function (PROC FCMP) for this purpose. The latter will be particularly convenient when it comes to creating graphs visualizing the relationship between sample size and other statistics in the context of tolerance intervals. (How do you define a "power curve" for a tolerance interval rather than a hypothesis test?)

 

Here is an example for the case of a normal distribution: The DATA step below simply passes through the sample sizes n=2, 3, 4, ..., until the criterion for the one-sided tolerance interval is met (see the Minitab documentation linked above; I denote their parameters a, a* and e by a, ax and e, respectively).

data want;
a=0.05;
p=0.95;
e=0.03;
ax=0.05;
do n=2 to 1e6 until(q1<=q2);
  q1=quantile('t',1-a,n-1,probit(p)*sqrt(n));
  q2=quantile('t',ax,n-1,probit(p+e)*sqrt(n));
end;
put n=;
run;

The same result, n=177, can be obtained with the user-defined function ntolu defined below:

proc fcmp outlib=work.funcs.test;
function f(a,p,e,ax,n);
  return(quantile('t', ax,n-1,sqrt(n)*probit(p+e))
        -quantile('t',1-a,n-1,sqrt(n)*probit(p)));
endsub;

function ntolu(a,p,e,ax,init);
  n=ceil(solve('f',{init},0,a,p,e,ax,.));
  return(n);
endsub;
run;

options cmplib=work.funcs;

data _null_;
n=ntolu(0.05,0.95,0.03,0.05,100);
put n=;
run;

For other parameter values you may or may not need to adjust the initial value (init=100) in the last argument of the function.

 

Simulated data could be used to verify that the sample size is sufficient to achieve the target values specified in the parameters.

View solution in original post

3 REPLIES 3
sbxkoenk
SAS Super FREQ

Hello,

 

I believe in JMP you can also do this through a menu driven platform.

(JMP is a wholly owned subsidiary of SAS --> https://community.jmp.com/)

 

In SAS, you will need some programming.

Start here :

Koen

FreelanceReinh
Jade | Level 19

Hello @djgetty and welcome to the SAS Support Communities!

 

Looking at the formulas in the Minitab® 20 documentation Methods and formulas for Sample Size for Tolerance Intervals, I think you can compute the sample size in a DATA step. You can also define a function (PROC FCMP) for this purpose. The latter will be particularly convenient when it comes to creating graphs visualizing the relationship between sample size and other statistics in the context of tolerance intervals. (How do you define a "power curve" for a tolerance interval rather than a hypothesis test?)

 

Here is an example for the case of a normal distribution: The DATA step below simply passes through the sample sizes n=2, 3, 4, ..., until the criterion for the one-sided tolerance interval is met (see the Minitab documentation linked above; I denote their parameters a, a* and e by a, ax and e, respectively).

data want;
a=0.05;
p=0.95;
e=0.03;
ax=0.05;
do n=2 to 1e6 until(q1<=q2);
  q1=quantile('t',1-a,n-1,probit(p)*sqrt(n));
  q2=quantile('t',ax,n-1,probit(p+e)*sqrt(n));
end;
put n=;
run;

The same result, n=177, can be obtained with the user-defined function ntolu defined below:

proc fcmp outlib=work.funcs.test;
function f(a,p,e,ax,n);
  return(quantile('t', ax,n-1,sqrt(n)*probit(p+e))
        -quantile('t',1-a,n-1,sqrt(n)*probit(p)));
endsub;

function ntolu(a,p,e,ax,init);
  n=ceil(solve('f',{init},0,a,p,e,ax,.));
  return(n);
endsub;
run;

options cmplib=work.funcs;

data _null_;
n=ntolu(0.05,0.95,0.03,0.05,100);
put n=;
run;

For other parameter values you may or may not need to adjust the initial value (init=100) in the last argument of the function.

 

Simulated data could be used to verify that the sample size is sufficient to achieve the target values specified in the parameters.

djgetty
Calcite | Level 5

Thank you. This is the type of solution I was looking for. I will give it a try and see where it goes. I appreciate you taking the time to help me with this issue!

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 464 views
  • 3 likes
  • 3 in conversation