Minitab: Calculating sample variance in macro -


so have set of samples in c1 in minitab, , make 200 resamples data , store in c2-c201. want calculate sample variance each of these columns , save result in seperate column. can calculate sample variance each of columns, having trouble saving results. current macro:

gmacro          #starts global macro resample        #names macro k1=2:201 sample 16 'data' ck1; replace.        #resampling name c202 "variance" statistics ck1;     # calculate s^2    variance 'variance'. enddo endmacro        #ends macro 

this job, overwrites same cell on , over. optimal thing save c202(k1) each iteration, i'm not sure how implement this.

hmmm. there many ways change macro.

the cause of stated problem variance subcommand statistics stores results in whole column, overwriting contents. if want store 200 separate subsamples in separate columns should it:

gmacro          #starts global macro resample        #names macro name c202 "variance" # no need name column 200 times! k1=2:201   sample 16 'data' ck1;     replace.        #resampling   statistics ck1;     # calculate s^2      variance c203.  # row 1 of temporary column c203   stack 'variance' c203 'variance' # append end of variance enddo erase k1 c203  # clean endmacro        #ends macro 

if want store subsamples happy store them in 2 columns neater:

gmacro          #starts global macro resample        #names macro name c2 'sample number' c3 'sample data' set 'sample number' # populate sample number (1:200)16 end k1=1:200    sample 16 'data' c4;     replace.        #resampling   stack c4 'sample data' 'sample data' # append sample data enddo name c4 "variance" statistics 'sample data';   'sample number';   variance 'variance'. endmacro        #ends macro 

of course, 200 x 16 samples replacement identical 3200 samples replacement neater - , faster- be:

gmacro          #starts global macro resample        #names macro name c2 'sample number' c3 'sample data' set 'sample number' # populate sample number (1:200)16 end sample 3200 'data' 'sample data'; replace. name c4 "variance" statistics 'sample data';   'sample number';   variance 'variance'. endmacro        #ends macro 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

android - Keyboard hides my half of edit-text and button below it even in scroll view -