Professional Documents
Culture Documents
Overall Mean Imputation Source Code
Overall Mean Imputation Source Code
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 !
! 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
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
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)
CLOSE #3
CLOSE #4
CLOSE #5
CLOSE #6
END