How Can I Run a Nonlinear Regression Macro in Minitab (simple syntax error)?

585 views Asked by At

I'm new to scripting Minitab 17 and have run into a snag that I can't find any documentation for, including an error message that brings up no hits on Google. All I want to do is generate macros that perform simple nonlinear regressions automatically, all of which execute just fine in the GUI or through Session Commmands. If I follow the directions on p. 10 of the Minitab Macros documentation and copy the commands I've successfully run from the Project Manager/History folder, copy them into a .MAC file and surround them with GMACRO and ENDMACRO commands, I end up with the code below:

GMACRO
NLinear;
  Response 'MyColumn1';
  Continuous 'MyOtherColumn2';
  Parameter "Theta1" 0.5;
  Parameter "Theta2" 0.2;
  Expectation Theta1 * ln (MyOtherColumn2 - Theta2 );
  NoDefault;
  TMethod;
  TStarting;
  TConstraints;
  TEquation;
  TParameters;
  TSummary;
  TPredictions.
ENDMACRO

The code between the MACRO statements runs OK from the GUI or as a Session Command. When I run the resulting macro file from the session prompt in Minitab, however, I invariably receive the following error: "Arguments not allowed in all global macro mode." I also receive syntax errors for every column that includes quote marks, even though that is standard session window syntax; I can eliminate these by substituting the column heading from my open worksheet, such as "C1", but can't get past the other error.

I'm obviously using some kind of incorrect syntax element(s) but can't pin them down - does anyone have any ideas? There are plenty of instructional materials on Minitab macros on the Web, but I haven't yet encountered any that deal with either this particular error or that delve much into how to execute ordinary Minitab tests of this kind. My goal is merely to write batch files that will do all my nonlinear regressions on off-hours etc. Thanks in advance.

3

There are 3 answers

5
user20637 On BEST ANSWER

Re-read pages 10-11 of http://support.minitab.com/en-us/minitab/18/macros-help/#page10.

The line after GMACRO should be the name of the macro, not a command.

Also, note that in a global macro the column names in 'single quotes' must exist in the active worksheet.

1
Patinber On

the better way to learn Minitab macro is to do the job by the menu and then to go to the SESSION WINDOW and to look at how Minitab uses the function. Do your Nonlinear Regression with your data and then in the SESSION WINDOW (first icon of the Project Manager bar) you will see the code. After that it is more easy to do macro.

0
Patinber On

In this case I think about an issue I had sometimes: I don't know why but sometimes I had to switch the regional setting ('.' instead of ',' for numeric values) or to write ',' instead of ';' in the macro. You can try this.