You are on page 1of 2

REM Overall Mean Imputation

LET TOT = 4130 ! TOT = Total number of observations for both variables !
LET NRR = .30 ! NRR = NonResponse Rate !
LET NON = NRR * TOT ! NON = Number of Nonresponse observations!
DIM SIMI(TOT,5) ! Matrix that will contain the income data !
DIM SIME(TOT,5) ! Matrix that will contain the expenditure data !

! Breakdown of the Matrices !


! 1st Column = Education status categories !
! 2nd Column = First visit data of the nonresponse variable!
! 3rd Column = Second visit data of the nonresponse variable!
! 4TH Column = Second visit data containing nonresponse observation of the nonresponse variable!
! 5TH Column = Flags that are indicators if the values of the fourth column are set to nonresponse/imputed
(5th column = 0) and response/actual (5th column = 1) !

! Opening and creation of files to be used to upload the data and write the results in the program !
OPEN #1: NAME "E:\MISSI30%.CSV"
MAT READ #1: SIMI
CLOSE #1
OPEN #2: NAME "E:\MISSE30%.CSV"
MAT READ #2: SIME
CLOSE #2
OPEN #3: NAME "E:\IDATA30%.TXT"
ERASE #3
OPEN #4: NAME "E:\EDATA30%.TXT"
ERASE #4

REM Computation of the overall mean of the first visit nonresponse variables to be imputed later on the
program

FOR I = 1 TO TOT
LET OMEX = OMEX + SIME(I,2)
LET OMIN = OMIN + SIMI(I,2)
NEXT I
LET OMEX = OMEX/TOT
LET OMIN = OMIN/TOT

REM Imputation Procedures

REM Substitution of the mean to the nonresponse observations

FOR J = 1 TO NON
LET SIMI(j,4) = OMIN
LET SIME(J,4) = OMEX
NEXT J

REM Computation of the mean deviation, mean absolute deviation, root mean square deviation

! INCDOMI = deviation of the imputed and the actual observation for the income variable under OMI !
! EXPDOMI = deviation of the imputed and the actual observation for the expenditure variable under
OMI !
LET INCDOMI = 0
LET EXPDOMI = 0

! INCMDOMI = mean deviation of the imputed and the actual observation for the income variable under
OMI !
! EXPMDOMI = mean deviation of the imputed and the actual observation for the expenditure variable
under OMI !

LET INCMDOMI = 0
LET EXPMDOMI = 0

! INCMADOMI = mean absolute deviation of the imputed and the actual observation for the income
variable under OMI !
! EXPMADOMI = mean absolute deviation of the imputed and the actual observation for the expenditure
variable under OMI !

LET INCMADOMI = 0
LET EXPMADOMI = 0

! INCRMSDOMI = root mean square deviation of the imputed and the actual observation for the income
variable under OMI !
! EXPRMSDOMI = root mean square deviation of the imputed and the actual observation for the
expenditure variable under OMI !

LET INCRMSDOMI = 0
LET EXPRMSDOMI = 0

FOR I = 1 TO NON

! Computation of the criteria to be evaluated !

LET INCDOMI = SIMI(I,3) - SIMI(I,4)


LET EXPDOMI = SIME(I,3) - SIME(I,4)
LET INCMDOMI = INCMDOMI + INCDOMI
LET EXPMDOMI = EXPMDOMI + EXPDOMI
LET INCMADOMI = INCMADOMI + ABS(INCDOMI)
LET EXPMADOMI = EXPMADOMI + ABS(EXPDOMI)
LET INCRMSDOMI = INCRMSDOMI + (INCDOMI^2)
LET EXPRMSDOMI = EXPRMSDOMI + (EXPDOMI^2)

NEXT I
LET INCMDOMI = INCMDOMI/NON
LET EXPMDOMI = EXPMDOMI/NON
LET INCMADOMI = INCMADOMI/NON
LET EXPMADOMI = EXPMADOMI/NON
LET INCRMSDOMI = SQR(INCRMSDOMI/NON)
LET EXPRMSDOMI = SQR(EXPRMSDOMI/NON)

MAT WRITE #3: SIMI


MAT WRITE #4: SIME

WRITE #5: INCMDOMI, INCMADOMI, INCRMSDOMI


WRITE #6: EXPMDOMI, EXPMADOMI, EXPRMSDOMI

CLOSE #3
CLOSE #4
CLOSE #5
CLOSE #6
END

You might also like