# Return to Minitab macro index

# How to save this page as a macro

# BONF.MAC 
# This macro computes the Bonferroni multiple comparisons T critical value.
# 
# Usage:
#    %bonf N DF; 
#       alpha A;
#       means M.  
# where:
#   N  is number of comparisons
#   DF is degrees of freedom
#   A  is confidence level (default = 0.95)
#   M  is number of means (if given, this computes N = M(M-1)/2)
# 
#  AUTHOR:  Darryl K. Nester
#           Bluffton College 
#           Bluffton, OH  45817
#           (419)358 - 3483  
#
MACRO 
BONF N DF;
 ALPHA A;
 MEANS M.

MCONSTANT A M N DF temp H
MCOLUMN Ac Nc DFc tstar
MTITLE 'Bonferroni Multiple Comparisons Method'

#NOTE 
#NOTE  Neither Minitab Inc. nor the author of this MACRO makes any claim 
#NOTE  or offers any warranty whatsoever with regard to the accuracy of 
#NOTE  this MACRO or its suitability for use, and Minitab Inc. and the 
#NOTE  author of this MACRO each disclaims any liability with respect thereto.   
#NOTE   

BRIEF 0
NOTITLES

IF ALPHA = 1
  IF A<1
    LET A = A * 100
  ENDIF
  IF A>100 OR A<0
    LET A = 5
  ENDIF
ELSE
  LET A = 5
ENDIF

IF MEANS = 1
  LET N = M * (M-1) / 2
ENDIF 

LET temp = 1 - A / 100 / 2 / N
LET Nc = N
LET Ac = A
LET DFc = DF
INVCDF temp tstar;
   T DF.

BRIEF 2
PRINT tstar Ac Nc DFc;
  FORMAT ('  t**=',F9.6,'  (alpha=',F6.3,'%, ',I3,' comparisons, df=',I3,')').

TITLES
ENDMACRO