Statistical programming, matrix languages, and more

No results being generated despite no Errors??

Reply
Occasional Contributor
Posts: 11

No results being generated despite no Errors??

Hi all. how can i print  the "SE" in my coding. No error was stated but the result shows nothing.

 

PROC IML;
RESET NONAME;


START BOXPLOT(A) GLOBAL (NY,BOBS);
BOBS=NCOL(NY); 
Q1=J(BOBS,1,0); ***Q1 having a matric J;
Q3=Q1; ***Q3 follow matric J Q1;
RMAD=Q1;
MADN=Q1;
LOWFEN=Q1;
UPPFEN=Q1;
LEFT=Q1; ***LEFT =DATA W/O OUTLIERS;
NEWN=Q1;
HA=Q1; ***HA=NEW NO.OF SAMPLE;
TRIMEAN=Q1;
SS=Q1;
SM=Q1;
SEM=Q1;

F=1; *** initial sampel values for the next subroutine;
M=0; *** initial number of looping for the next subroutine;

DO J=1 TO BOBS; *** NCOL = no of column in data set;
SAMP=NY[J]; *** SAMP = no of sample in every j;
L=M+SAMP;
TEMP=A[F:L]; ** temporary samples;

Q=quartile (TEMP);
Q1[J]=Q[2,1]; *** first quartile calculation;
Q3[J]=Q[4,1]; *** third quartile calculation;
RMAD[J]=MAD(TEMP,"MAD"); ***rmad=median absolute deviation;
MADN[J]=MAD(TEMP,"NMAD"); ***madn=mad/1.4826;
LOWFEN[J]=Q1[J]-(1.44*MADN[J]); ***lowfen=lower fence;
UPPFEN[J]=Q3[J]+(1.44*MADN[J]); ***uppfen=upper fence;
LEFT=TEMP[LOC(LOWFEN[J]<TEMP & TEMP<UPPFEN[J])]; ***left=sample without outliers;
NEWN=NROW (LEFT);
HA=NEWN;
TRIMEAN=SUM(LEFT)/HA;
/*SS=VAR(LEFT); ***KENA KIRA WINSORIZE VARIANCE;
SM=STD(LEFT); ***KENA KIRA WINSORIZE STANDARD ERROR BUKAN STD;
SEM=SM;*/

M=L;
F=F+SAMP;
*PRINT TRIMEAN;


END;

 

FINISH;

***MENJANA SAMPEL BUTSTRAP UNTUK PENGIRAAN RALAT PIAWAI PENGANGGAR
MOM **;
START BOOTDAT(A, TRIMEAN, YB) GLOBAL(NY, NTOT, BOBS, SEED);
F = 1;
M = 0;
DO J = 1 TO BOBS;
L = M+NY[J];
TEMP = A[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**;

***** PEMUSATAN DATA BUTSTRAP *****************;
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, BOBS, SEED);
**CALL DATAMOD(YB, CRITB, YMATB);
**CALL TRIMMOD(YMATB, CRITB, TRIMMNB, MUBARMB, HB);
CALL BOXPLOT(A);

FINISH;

************* PENGIRAAN RALAT PIAWAI ********************;
START SEBOXPLOT;
**CALL DATAMOD(Y, CRIT, YMAT);
**CALL TRIMMOD(YMAT, CRIT, TRIMMN, MUBARM, H);
CALL BOXPLOT(A);
DO BOOTLOOP = 1 TO NUMSIM;
CALL BOOTDAT(A, TRIMEAN, YB);
CALL BOOTSTAT(YB, TRIMEANB);
IF BOOTLOOP = 1 THEN TMEANB = TRIMEANB;
ELSE TMEANB = TMEANB//TRIMEANB;
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]);
PRINT SE;
END;
FINISH;

**BILANGAN SAMPEL BUTSTRAP**;
NUMSIM = 50;
**SEED UTK BUTSTRAP**;
SEED = 40389;

*************AG TEST****************************;

/*START AG(A,TRIMEAN,SEM,HA,INVVAR,SUMP,WEIGHT,XPLUS,WEIGMEAN,TJ)
GLOBAL(NY,DF);

INVVAR=J(NCOL(NY),1,0);
WEIGHT=J(NCOL(NY),1,0);
XPLUS=WEIGHT;
WEIGMEAN=WEIGHT;
TJ=WEIGHT;
DF=WEIGHT;

F=1;
M=0;

DO J=1 TO NCOL(NY);
SAMP=NY[J];
L=M+SAMP;
TEMP=A[F:L];
INVVAR=INV(SEM##2);
DO K=1 TO NCOL(NY);
SUMP=SUM(INVVAR);
WEIGHT[K]=INVVAR[K]/SUMP;
XPLUS[K]=WEIGHT[K]*TRIMEAN[K];


END;

DF[J]=HA[J]-1;
M=L;
F=F+SAMP;
PRINT INVVAR;
END; 
FINISH;**/

********cubaan menggunakan data yg dijana*******;

NY = {11 11 11};
A = {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};


RUN BOXPLOT(A);
CALL BOXPLOT(A);


QUIT;

Regular Contributor
Posts: 168

Re: No results being generated despite no Errors??

The PRINT statement in the BOXPLOT module is commented out!

Ask a Question
Discussion stats
  • 1 reply
  • 133 views
  • 0 likes
  • 2 in conversation