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MP1,"NMAD");
LOWFEN[,J]=Q1[,J]-(1.44*MADN[,J]);
UPPFEN[,J]=Q3[,J]+(1.44*MADN[,J]);
LEFT=TEMP1[LOC(LOWFEN[,J]<TEMP1 & TEMP1<UPPFEN[,J])];
LEFTDATA=LEFT;
NEWN=NROW (LEFTDATA);
HA=NEWN;
TRIMEAN[,J]=SUM(LEFTDATA)/HA;
M=L;
F=F+SAMP;
*PRINT 'LEFT DATA' LEFT;
*PRINT "SORT DATA" YT;
END;
*PRINT "ORI DATA" Y;
*PRINT "DEPTH OF Q3" DOQ3;
*PRINT IDOQ3;
*PRINT DECIMAL3;
*PRINT Q3DIFF;
*PRINT "DEC Q3" Q3DEC;
*PRINT "Q3=" Q3;
*PRINT "RMAD" RMAD;
*PRINT MADN;
*PRINT "QUARTILE=" Q;
*PRINT "Q1=" Q1;
*PRINT "LOWER FENCE" LOWFEN;
*PRINT "BOXPLOT TRIMMEAN = " TRIMEAN;
FINISH;
***MENJANA SAMPEL BUTSTRAP UNTUK PENGIRAAN RALAT PIAWAI PENGANGGAR
MOM **;
START BOOTDAT(Y, TRIMEAN, YB) GLOBAL(NY, NTOT, WOBS, BOBS, SEED);
F = 1;
M = 0;
DO J = 1 TO BOBS;
L = M+NY[J];
TEMP = Y[F:L,];
BVAL = TEMP;
DO P = 1 TO NROW(TEMP);
RVAL = UNIFORM(SEED);
BVAL[P,] = TEMP[CEIL(NROW(TEMP)#RVAL),];
END; **DO P**;
IF J = 1 THEN YB = BVAL;
ELSE YB = YB//BVAL;
M = L;
F = F + NY[J];
END; **DO J**;
***** CENTRALIZATION OF BOOTSTRAP DATA *****************;
F = 1;
M = 0;
DO I = 1 TO BOBS;
L = M + NY[I];
MVAL = TRIMEAN[,I];
DO K = F TO L BY 1;
YB[K,] = YB[K,] - MVAL;
END; **DO K**;
M = L;
F = F + NY[I];
END; ** DO I**;
FINISH;
START BOOTSTAT(YB, TRIMEANB) GLOBAL(NY, NTOT, WOBS, BOBS, SEED);
CALL BP(YB, LOWFENB, UPPFENB, LEFTDATAB, TRIMEANB);
FINISH;
************* CALCULATION OF STANDARD ERROR********************;
START SEBOXPLOT;
CALL BP(Y, LOWFEN, UPPFEN, LEFTDATA, TRIMEAN);
F = 1;
M = 0;
DO BOOTLOOP = 1 TO NUMSIM;
CALL BOOTDAT(Y, TRIMEAN, YB);
CALL BOOTSTAT(YB, TRIMEANB);
IF BOOTLOOP = 1 THEN TMEANB = TRIMEANB;
ELSE TMEANB = TMEANB//TRIMEANB;
*PRINT 'BOOTSTRAP DATA' YB;
END; **DO BOOTLOOP**;
VAR=J(1, BOBS, 0);
SE=J(1,BOBS,0);
DO I=1 TO BOBS;
VAR[,I]=(SSQ(TMEANB[,I])-(SUM(TMEANB[,I])**2/NUMSIM))/(NUMSIM-1);
SE[,I]=SQRT(VAR[,I]);
END;
PRINT "BOOTSTRAP STANDARD ERROR=" SE;
FINISH;
*/
**BILANGAN SAMPEL BUTSTRAP**;
NUMSIM = 50;
**SEED UTK BUTSTRAP**;
SEED = 40389;
********cubaan menggunakan data yg dijana*******;
NY = {11 11 11};
Y = {5,8,7,3,9,4,3,29,5,6,7,
3,2,6,4,14,4,7,6,9,3,4,
9,9,8,7,10,11,27,12,15,17,16};
*PRINT 'ORI DATA' Y;
RUN SEBOXPLOT;
/*
CALL AG (A, TRIMEAN, SEM, HA, INVVAR, SUMP, WEIGHT, XPLUS, WEIGMEAN,TJ);
CALL TRANS(A, B, C, ZJ, ZZJ, TEST, P);
*/
*CALL BP(A, LOWFEN, UPPFEN, LEFT);
QUIT;
Hi all, basically this is my coding. how do i get the bootstrap standard error.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I'm not sure I grasp the question.
It seems like the IML code you are showing actually prints the bootstrap standard error.
PRINT "BOOTSTRAP STANDARD ERROR=" SE;
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
the bootstrap SE is the standard deviation of the bootstrap distribution. It looks like the statistics are stored in the TMEANB vector in the SEBOXPLOT module. You can get the standard error as
SE = std( TMEANB );
By the way, it looks like you are using a loop to try to compute the variance and std error. No loops are necessary.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
thank you. but for now I cannot figure out what is happening at "LEFT=TEMP1[LOC(LOWFEN[,J]<TEMP1 & TEMP1<UPPFEN[,J])];", this code affects entire programming.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Did you write this code yourself or did you get it from someone else?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Only module BOOTDAT I took from my supervisor.