Running Code as a Simulation in Minitab

J

jiao88

Hi all,

I am new to Minitab. Refer to my code, if I were to run the code as simulation for like 1000 time, how can I store the 1000 results for my coefficient every time I run it? My current code will replace the coefficient to the latest coefficient only :truce: Please advice. :eek:


Name C1 "u"
Name C2 "t"
Name C4 "x"
Name C5 "COEF1"
Name C6 "SECO1"
Name C7 "CLCO1"
Name C8 "CLCO2"

Random 20 c1;
Uniform 0.0 1.0.
Random 20 c4;
Normal 0.0 1.0.

let c2=exp(0.4*log(-log(1-u))+3+3*x)

Lregression 't'=x;
Weibull;
Coefficient 'COEF1';
Secoefficient 'SECO1';
Clcoefficient 'CLCO1'-'CLCO2';

Brief 2;
Confidence 95.0.

let k1=1
let k2=10
let Ck2(1)=C5(1)
let Ck2(2)=C5(2)
let Ck2(3)=C5(3)

let k1=k1+1
let k2=k2+1
 
A

Allattar

Try stacking it into a new columns using the stack command.

Then build a subscript column to identify the run number.
 
J

jiao88

If I use the stack command, meaning I need to list out all the result for 1000 replications before I stack it? or I can still stack it into 1 column even though I do not have the result for 1000 replications?
 
J

jiao88

My current way of running a simulation is just execute the .mtb file for 1000 times. But seems like the part

let k1=1
.
.

let k1=k1+1

didnt run at all. Is my way of doing simulation is wrong? :confused::confused:
 
S

steelejc15425

I agree with Wang1568, you will need a macro to do the loop.

You can get more information from Help > Help >Macros (select on left side).

I think this will get you started though. Notice that your file has to start with gmacro, followed by a name for the macro, and that your file has to end with endmacro.

To run your macro, you will have to have your cursor in the white window (Session Window), then on the menus click Editor > Enable Commands.

If you save it in the Minitab macros folder, you can invoke it by typing the name after a % symbol. Otherwise, type the full file path after a % symbol:
%C:\Users\you\sample.mac

where you type your file name instead of sample.mac.

Let us know if you get stuck!

gmacro
macroname

Name C1 "u"
Name C2 "t"
Name C4 "x"
Name C5 "COEF1"
Name C6 "SECO1"
Name C7 "CLCO1"
Name C8 "CLCO2"
let k1=1
let k2=10

do k1 =1:10 10
Random 20 c1;
Uniform 0.0 1.0.
Random 20 c4;
Normal 0.0 1.0.
let c2=exp(0.4*log(-log(1-u))+3+3*x)
Lregression 't'=x;
Weibull;
Coefficient 'COEF1';
Secoefficient 'SECO1';
Clcoefficient 'CLCO1'-'CLCO2';

Brief 2;
Confidence 95.0.
let Ck2(1)=C5(1)
let Ck2(2)=C5(2)
let Ck2(3)=C5(3)

let k2=k2+1
enddo
endmacro
 
Top Bottom