Macros from Minitab To Save a Page as a Macro

advertisement
000Macro Largely copied from Minitab Site 1/26/07
Macros from Minitab
To Save a Page as a Macro
1.
2.
3.
4.
5.
6.
Select or highlight the code for the macro, beginning with the word “macro”, and ending in
“endmacro”.
Choose Edit > Copy.
Open Notepad and choose Edit > Paste.
Choose File>Save As and type the file name in double-quotes including the .mac extension.
The name of the macro is typically listed below the “macro” line in the body of the macro.
For example, “BARTLETT.MAC”.
Save the file to the macros folder under the main Minitab directory.
In Minitab, invoke the macro in the Session window or Command Line Editor by typing %,
followed by the macro name. For example, %BARTLETT.
If you still have questions, you can e-mail us.
You may need to set up a folder for your Macros. You need to be sure that Minitab
can find this folder. I find it convenient to prepare and save a dummy worksheet
using Minitab and to store it in the same file in which the Macros are kept. Mine is
called ‘notmuch.mtw.’ This worksheet can have absolutely anything on it. Then,
when the macros are called, there is no problem finding them. You simply use the
‘editor’ pull-down menu to ‘enable commands.’ When you want to use the macro,
use the ‘file’ pulldown menu to load your worksheet. Minitab will assume that the
macro is in the same file. Use Notepad to open the macro to get instructions on how
to use it.
Macros below are classified as ‘General Statistics,’ ANOVA and Regression’ and
‘Nonparametrics.’ These and much more are available at
http://www.minitab.com/support/macros/
General Statistics
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
Binomial CDF for Multiple Trials
Boxplot3
Business Days
Calculating Percentiles
Combinations
Cronbach's Alpha
Display Median, Q1, and Q3 on a Dotplot
Expanding Frequencies
Frequencies and Percents from Intervals Produced by a Histogram
Half-Normal Plots
Mean and Standard Deviation
Median of Tallied Data
Median Smoother
Mode for Simple Data or Grouped Data
Multinomial Probabilities
Normal Curve with Shaded Tails
Normplot Storage
One Sample Test of the Variance
Principal Components Biplot
Random Data from a Negative Binomial Distribution
Random Normal
Ranks by Group
Smooth
000Macro Largely copied from Minitab Site 1/26/07
24.
25.
26.
27.
28.
29.
Stratified Random Sampling
Table
Table of Frequencies and Percents from a default Histogram
Tolerance Intervals
Trimmed Mean
Weighted Mean and Weighted Standard Deviation
Binomial CDF for Multiple Trials
This macro generates the cumulative probability of the binomial distribution with a number
of trials from one column, a number of successes from a second column, and a given
probability of success, row by row.
Written by Joel Smith
Use with releases: 14 and 15
Code
Back to Top
Boxplot3
This macro creates a boxplot in which the outliers are based on 3 times the interquartile
range (instead of 1.5) and are optionally stored in the worksheet.
Written by Andy Haines
Use with releases: 14 and 15
Code
Back to Top
Business Days
This macro stores the number of business days from one date to another. Note: the start
and end dates are included in the count, as well as holidays if they fall on a weekday. This
functionality has been added to Release 15. Choose Calc > Calculator and select the
function Workdays or Net Workdays.
Written by Michelle Paret
Use with releases: 14
Code
Back to Top
Calculating Percentiles
This macro calculates user specified percentiles for a data column. You can also use a "By"
variable to calculate the percentiles for groups. Part of this functionality has been added to
Release 15. Choose Calc > Calculator and the function percentiles to calculate percentiles of
an entire column.
Written by Andy Haines
Use with releases: 14 and 15
Code Documentation
Back to Top
Combinations
This macro calculates the number of different combinations of size r items drawn from N
distinct items. The r items are sampled without replacement. The number of combinations
is phrased as "N choose r". This functionality has been added to Release 15. Choose Calc >
Calculator and select the function Combinations.
Written by Cathy Akritas
Use with releases: 14
Code
Back to Top
Cronbach's Alpha
This macro calculates the value for Cronbach's alpha for the input data. Cronbach's alpha is
a coefficient of reliability (or consistency). This functionality has been added to Release 15.
Choose Stat > Multivariate > Item Analysis.
Written by Nick Bolgiano
000Macro Largely copied from Minitab Site 1/26/07
Use with releases: 14
Code
Back to Top
Display Median, Q1, and Q3 on a Dotplot
This macro creates a dotplot for each input variable and plots the median, Q1, and Q3.
There is an option to plot the mean, and the mean +- 1 standard deviation instead.
Written by Nick Bolgiano and Steve Orlich
Use with releases: 14 and 15
Code
Back to Top
Expanding Frequencies
This macro "untallies" data by taking a frequency table and creating from it a single column
of data.
Written by Andy Haines
Use with releases: 14 and 15
Code Documentation
Back to Top
Frequencies and Percents from Intervals Produced by a Histogram
This macro displays the intervals, frequencies, and percents from a histogram where the
user specifies the intervals.
Written by Cathy Akritas
Use with releases: 14 and 15
Code
Back to Top
Half-Normal Plots
This macro creates half-normal plots. In Release 15, choose Stat > DOE > Factorial >
Analyze Factorial Design or Stat > DOE > Factorial > Analyze Variability.
Written by Ulrike Groemping
Use with releases: 14
Code
Back to Top
Mean and Standard Deviation
This macro calculates the mean and standard deviation for the first two rows, then the first
three rows, etc. of a column.
Written by Unknown
Use with releases: 14 and 15
Code
Back to Top
Median of Tallied Data
This macro displays the median of tallied, or tabled, data in the Session window.
Written by Cathy Akritas
Use with releases: 14 and 15
Code
Back to Top
Median Smoother
This macro calculates a median smoother with a default span of 3. The 1st observation of
the smoothed data is the median of the 1st 3 data points (X1, X2, X3). The 2nd observation
of the smoothed data is the median of the (X2, X3, X4). The 3rd observation is the median
of (X3, X4, X5)… Thus, the smoothed data represents a moving median of the original data.
Written by Cathy Akritas
Use with releases: 14 and 15
Code
Back to Top
000Macro Largely copied from Minitab Site 1/26/07
Mode for Simple Data or Grouped Data
This macro finds the mode of the input data, which can be numeric, text, or dates. You can
also supply one or two grouping variables and the macro will find the mode for each group.
The grouping variables can also be text, numeric, or dates. This functionality has been
added to Stat > Basic Statistics > Display Descriptive Statistics.
Written by Cathy Akritas
Use with releases: 14
Code
Back to Top
Multinomial Probabilities
This macro calculates multinomial probabilities for user-specified observed numbers and
probabilities of success.
Written by John S. Heywood
Use with releases: 14 and 15
Code
Back to Top
Normal Curve with Shaded Tails
This macro draws a normal curve with shaded tails, shading the specified proportion of area
in the tails. The default behavior is to draw a standard normal curve and shade half of the
specified area in the upper tail and half in the lower tail. Optionally, you can change the
curve from the standard normal curve to a normal curve with a specified mean and
standard deviation or place the entire shaded area in either the upper or lower tail. This
functionality has been added to Release 15. Choose Graph > Probability Distribution Plot.
Written by Cathy Akritas
Use with releases: 14
Code
Back to Top
Normplot Storage
This macro stores the Anderson-Darling test statistic (A-Squared) and p-value for the
normality test in the worksheet.
Written by Michelle Paret
Use with releases: 14 and 15
Code
Back to Top
One Sample Test of the Variance
Performs a two-tailed hypothesis test for a single population variance. This functionality has
been added to Release 15 at Stat > Basic Statistics > 1 Variance
Written by Cathy Akritas
Use with releases: 14
Code
Back to Top
Principal Components Biplot
This macro creates a Principal Components Biplot. This functionality has been added to
Release 15. Choose Stat > Multivariate > Principal Components or Stat > Multivariate >
Factor Analysis.
Written by Andy Haines
Use with releases: 14
Code
Back to Top
Random Data from a Negative Binomial Distribution
This macro generates random data from a negative binomial distribution. This functionality
has been added to Release 15. Choose Calc > Random Data > Negative Binomial.
Written by Cathy Akritas
Use with releases: 14
Code Documentation
000Macro Largely copied from Minitab Site 1/26/07
Back to Top
Random Normal
This macro generates a number from a normal distribution with the mean from one column
and standard deviation from another column, row by row.
Written by Unknown
Use with releases: 14 and 15
Code
Back to Top
Ranks by Group
This macro stores the ranks of the data for each level of a grouping variable.
Written by Cathy Akritas
Use with releases: 14 and 15
Code
Back to Top
Smooth
This macro replaces the missing values in a column using a smoothing technique that
handles missing values by assuming a linear relationship. This macro replaces missing
values in a column of data with the "average" of the data around them. One missing value
is replaced by the average of the observations before and after it. Multiple missing values
are replaced by "steps" between the known values.
Written by Andy Haines
Use with releases: 14 and 15
Code
Back to Top
Stratified Random Sampling
This macro generates a stratified random sample.
Written by Unknown
Use with releases: 14 and 15
Code
Back to Top
Table
This macro produces this kind of table in the Session window:
Results
--------- ---------Mean
0.087635
StDev
0.722207
--------- ---------Written by Andy Haines
Use with releases: 14 and 15
Code
Back to Top
Table of Frequencies and Percents from a default Histogram
This macro displays the frequency and percent of observations that fall into the default bins
created by histogram.
Written by Cathy Akritas
Use with releases: 14 and 15
Code
Back to Top
Tolerance Intervals
This macro calculates a (1-alpha)100% tolerance interval which covers at least p*100% of
the population (distribution).
000Macro Largely copied from Minitab Site 1/26/07
Written by Cathy Akritas
Use with releases: 14 and 15
Code Documentation
Back to Top
Trimmed Mean
This macro calculates the trimmed mean by removing the smallest p% and the largest p%
of the values (rounded to the nearest integer), and then averages the remaining values.
Written by Sarah Haines
Use with releases: 14 and 15
Code
Back to Top
Weighted Mean and Weighted Standard Deviation
This macro calculates the weighted mean and weighted standard deviation of a column of
data based on a frequency or weight column. Weights must be greater than or equal to 0,
and can be continuous or discrete (frequencies).
Written by Veronica Bubb
Use with releases: 14 and 15
Code
Back to Top
ANOVA & Regression
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
Added Variable Plots
ANOM for 2 Level, 2 Factor Design
Box-Cox Transformation for Regression and Response Surface Models
Box-Tidwell Procedure
Calibration or Inverse Regression
Coefficient of Multiple Correlation
Confidence Intervals for Regression Coefficients
Fitted Line Plot Through the Origin
Hildreth - Lu Procedure
Multiple Case Cook's Distance
Multiple Case Influence Analysis
Multiple Comparison Tests on Proportions
Nonlinear Regression
One-way ANOVA Confidence Intervals
PRESS Statistic for Regression data using a Power Transformation
Ridge Trace Plot
Standardized Regression Coefficients
Added Variable Plots
This macro creates added variable plots in a linear regression analysis.
Written by Mike Delozier
Use with releases: 14 and 15
Code Sample Data 1 Documentation
Back to Top
ANOM for 2 Level, 2 Factor Design
This macro creates an ANOM chart for a 2 factor, 2 level factorial design. The interaction
between the 2 factors is displayed on the same scale as the main effects. The default
decision limits are calculated at alpha = .05.
Written by Cathy Akritas
Use with releases: 14 and 15
Code Documentation
Back to Top
000Macro Largely copied from Minitab Site 1/26/07
Box-Cox Transformation for Regression and Response Surface Models
This macro determines the likelihood estimate of the Box-Cox power transformation
parameter in regression and response surface modeling applications. A plot of the loglikelihood function over a range of parameter values is displayed showing the likelihood
estimate and an approximate 95% confidence interval for the parameter. Also displayed is
a plot of the values of the PRESS statistic transformed back to the original response scale
over the 95% confidence interval. Optionally, the user may choose to specify the range of
parameter values in the plot of PRESS, display an index plot due to Cook and Wang (1983)
showing the influence of individual cases on the likelihood estimate, and store all computed
results.
Written by Steve Orlich and Mike Delozier
Use with releases: 14 and 15
Code Sample Data 1 Sample Data 2 Documentation
Back to Top
Box-Tidwell Procedure
This macro executes the Box-Tidwell procedure to determine appropriate predictor variable
power transformations for a regression model linear in the transformed predictors. It is
important to note that this procedure can be numerically unstable resulting in error
conditions for some data sets.
Written by Mike Delozier
Use with releases: 14 and 15
Code Sample Data 1 Sample Data 2 Documentation
Back to Top
Calibration or Inverse Regression
Obtains the point and interval estimate for a new value of X, the independent variable in a
simple regression equation, given a new determination of Y, the dependent variable. This is
referred to as the statistical calibration, or inverse regression.
Written by Janice Derr
Use with releases: 14 and 15
Code Documentation
Back to Top
Coefficient of Multiple Correlation
This macro stores the coefficient of multiple correlation for each column regressed on the
others.
Written by Andy Haines
Use with releases: 14 and 15
Code
Back to Top
Confidence Intervals for Regression Coefficients
This macro calculates confidence intervals for coefficients from a regression model.
Written by Veronica Bubb
Use with releases: 14 and 15
Code
Back to Top
Fitted Line Plot Through the Origin
This macro creates a fitted line plot that goes through the origin.
Written by Cathy Akritas
Use with releases: 14 and 15
Code
Back to Top
Hildreth - Lu Procedure
The Hildreth - Lu procedure corrects for serial correlation (autocorrelation) in regression
type data.
Written by Cathy Akritas
000Macro Largely copied from Minitab Site 1/26/07
Use with releases: 14 and 15
Code
Back to Top
Multiple Case Cook's Distance
This macro computes the multiple case extension of Cook's single case distance measure.
Depending on the data set size, the distance measure can be computed for all case pairs
and triplets. In addition, the distance measure can be computed for user selected subsets
of up to ten cases. Graphics produced include a plot of Cook's distance for single cases
against case number, an influential case pairs ID plot, and fixed-pair effect plots which
display the effect, or change in Cook's distance, due to adding a third case to a fixed pair of
cases. Like functionality is available for models with no constant term.
Written by Mike Delozier and Steve Orlich
Use with releases: 14 and 15
Code Sample Data 1 Documentation
Back to Top
Multiple Case Influence Analysis
This macro employs a novel backward elimination approach in searching for influential
multiple case subsets in linear regression using Cook's multiple case distance measure.
Written by Mike Delozier and Steve Orlich
Use with releases: 14 and 15
Code Sample Data 1 Documentation
Back to Top
Multiple Comparison Tests on Proportions
This macro performs a multiple comparisons test on proportion data using Tukey's honest
significant difference test.
Written by Daniel Griffith and Eduardo Santiago
Use with releases: 14 and 15
Code
Back to Top
Nonlinear Regression
Performs a nonlinear regression based upon use of the Gauss-Newton method to iteratively
find solutions to the nonlinear regression normal equations.
Written by Gary Stork
Use with releases: 14 and 15
Code Sample Data 1 Documentation
Back to Top
One-way ANOVA Confidence Intervals
This macro calculates the endpoints of the confidence intervals for the means that are given
by the commands ONEWAY, and AOVONEWAY.
Written by Cathy Akritas
Use with releases: 14 and 15
Code
Back to Top
PRESS Statistic for Regression data using a Power Transformation
This macro computes the model fits, residuals, deleted fits, deleted (PRESS) residuals, and
the PRESS statistic in the original units of the response when a power transformation of the
response is applied in a linear regression.
Written by Mike Delozier
Use with releases: 14 and 15
Code Sample Data 1 Sample Data 2 Documentation
Back to Top
Ridge Trace Plot
Produces a ridge trace plot and a plot of RSS VS K for data in 'y' and predictors formed into
the M1 matrix. M1 and 'y' should be in "correlation form". These plots are useful data
000Macro Largely copied from Minitab Site 1/26/07
analytic tools for ridge regression.
Written by Berton Gunter
Use with releases: 14 and 15
Code Sample Data 1
Back to Top
Standardized Regression Coefficients
This macro calculates the standardized coefficients for simple and multiple regression
analysis.
Written by Cathy Akritas
Use with releases: 14 and 15
Code
Back to Top
Nonparametrics
1.
2.
3.
4.
Kendall's Tau
Kruskal Wallis Multiple Comparisons
Mann-Kendall Test for Detecting Trends
Sen's Slope
Kendall's Tau
This macro calculates Kendall's Tau, a nonparametric ranked correlation statistic.
Written by Veronica Bubb
Use with releases: 14 and 15
Code
Back to Top
Kruskal Wallis Multiple Comparisons
The Kruskal Wallis H statistic is an overall test statistic that enables one to test the general
hypothesis that all population medians are equal. Often, the investigator is not extremely
interested in this general hypothesis but is interested in comparisons amongst the
individual groups. This macro performs multiple comparisons in a nonparametric setting.
Written by Steve Orlich
Use with releases: 14 and 15
Code Sample Data 1 Documentation
Back to Top
Mann-Kendall Test for Detecting Trends
This macro calculates the Mann-Kendall test for detecting trends in data collected over
time. An adjustment is made for tied observations in this non-parametric test. You must
have at least 10 observations for the Normal approximation to be appropriate.
Written by Cathy Akritas
Use with releases: 14 and 15
Code
Back to Top
Sen's Slope
This macro calculates Sen's Slope which is a nonparametric alternative for estimating a
slope for a univariate time series. This approach involves computing slopes for all the pairs
of ordinal time points and then using the median of these slopes as an estimate of the
overall slope. Sen's slope is insensitive to outliers and can be used to detect if there is a
trend in the data.
Written by Cathy Akritas
Use with releases: 14 and 15
Code
000Macro Largely copied from Minitab Site 1/26/07
Download