The University of St. Thomas

Minitab Macros for your use

Using them

 

Click on the name of the macro to either save it to a file or copy and paste it into a file, depending on what your browser does when you click on it.

In Minitab enable command language, if necessary. Make the Session Window active and go to the Editor pulldown menu to find the option of enabling command language.

In the session window, type %path_to_macro column_names. If you have copied the macro to the Macros subdirectory under Minitab, the macro name is path enough.  The column names are places where data resides, or where you want to store results. The description of each macro will provide details.

Aranova resp subs effs

 

This performs approximate randomization for oneway ANOVA. The responses are stacked in column resp, the subscripts identifying treatments are in column subs. The macro assumes equal replications for each treatment; it will ask how many treatments there are. By randomly permuting a copy of subs, the responses are regrouped. For each grouping, an F-statistic is computed; all such statistics are stored in column effs; the macro will ask how many times you want to permute.

 

Chisqrbc t1 t2 dist;

reps r.

This performs approximate randomization for the chisquared test for independence in a r by c contingency table.Worksheet rows are cases. Column t1 identifies table rows,and t2 identifies table columns.They may be text identifiers.This performs the usual conditional analysis, fixing the row and column totals and randomly assigning cell counts consistent with them. For each table, the chisquared statistic for testing independence is stored in column dist. The subcommand reps works like subcommands on Minitab commands. If it is omitted, 100 statistics will be stored in dist.

 

Sampfill x1 y.1 - y.p

 

This macro samples with replacement from data in column x1. There must be as many columns for receiving data, y.1 through y.p, as the size of the original sample; that is, p must equal the count of items in x1. Thus, each row of y.1 through y.p will be a resample of the same size as the original sample. The macro asks how many replications you want. You can then use Minitab's row statistics to get columns of sample means etc for the resamples.

 

Permute d s results

Permute2 d1 d2 results

 

Samples from 2 populations are in columns d1 and d2. Using approximate randomization, Permute2 creates a column of differences of sample means, results, for samples of sizes Count(d1) and Count(d2) drawn without replacement from a pool of all the data in d1 and d2. One can then compare the observed difference between means for samples from different populations with a distribution of such differences for random groups. Permute does the same thing, but for data stacked in d with subscripts (two consecutive integers) in s.

 

Datareg y x slopes ints

Residreg y x slopes ints

Regperm y x slopes ints

All of these macros deal with the simple regression in which y is response and x is predictor. They all create columns of slopesand intercepts ( ints). Datareg resamples cases ( pairs from y and x ). It assumes the randomness lies in which members of a bivariate population are chosen. Residreg randomly associates residuals from the original regression of y on x with the fitted values from that regression. It is similar to the usual regression assumptions in assuming that the randomness is in the residuals, but it does not assume they are normal. Regperm randomly associates the values from y with those from x. It shows what regressions would be like if the marginal distributions of y and x were as observed, but if y and x were independent .

 

Aregdata y x.1 - x.p

Mregdata y x.1 - x.p

Zregdata y x.1 - x.p

All are for multiple regression. They all resample cases, as in Datareg above. The subcommand coefs is mandatory for all of them and stores the regression coefficients into the columns you choose. Subcommand reps is optional to control the number of regressions performed. Subcommand ci is also optional; if it is given values g.1 - g.w for the predictors, it will provide a column est of predicted values for the associated y.

The macros differ in internal details. Mregdata may be the fastest, but can run into a (poorly documented) limit on the number of columns in use. Zregdata is internally straightforward, but probably the slowest.

Feedback and suggestions to Robert L. Raymond, rlraymond@stthomas.edu.