Created
July 24, 2015 15:00
Voyager Pearsons Correlation Coefficient
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Do not change filenames or add or remove FILEI/FILEO statements using an editor. Use Cube/Application Manager. | |
RUN PGM=MATRIX PRNFILE="C:\MODELRUN\TRUCKMODEL\CUBE\NPMAT00A.PRN" | |
FILEO PRINTO[1] = "C:\Modelrun\TruckModel\Cube\Inputs\InitStats.RPT" | |
FILEI DBI[1] = "C:\Modelrun\TruckModel\Cube\Inputs\TrucksLoaded.DBF" | |
PAR ZONES = 1 | |
LOOP r = 1, DBI.1.NUMRECORDS | |
x=DBIReadRecord(1, r) | |
IF(DI.1.TSCN > 0) | |
n = n + 1 | |
xx = xx + DI.1.AADT_TRK | |
y = y + DI.1.V_1 | |
ENDIF | |
ENDLOOP | |
mux = xx / n | |
muy = y / n | |
PRINT PRINTO = 1, LIST = "Avg AADT_TRK = ",mux | |
PRINT PRINTO = 1, LIST = "Avg VOLUME = ",muy | |
PRINT PRINTO = 1, LIST = "n = ",n,"\n\n\n" | |
n = 0 | |
LOOP r = 1, DBI.1.NUMRECORDS | |
x=DBIReadRecord(1, r) | |
IF(DI.1.TSCN > 0) | |
num = num + ((DI.1.AADT_TRK - mux) * (DI.1.V_1 - muy)) | |
sdx1 = sdx1 + (DI.1.AADT_TRK - mux)^2 | |
sdy1 = sdy1 + (DI.1.V_1 - muy)^2 | |
n = n + 1 | |
ENDIF | |
ENDLOOP | |
PRINT PRINTO = 1 LIST = "sdx1 = ",sdx1 | |
PRINT PRINTO = 1 LIST = "sdy1 = ",sdy1 | |
sdx = sqrt(sdx1 / n) | |
sdy = sqrt(sdy1 / n) | |
r2 = num / (sdx * sdy) | |
PRINT PRINTO = 1 LIST="n = ",n | |
PRINT PRINTO = 1 LIST="sd AADT_TRK = ",sdx | |
PRINT PRINTO = 1 LIST="sd Volume = ",sdy | |
PRINT PRINTO = 1 LIST="r2 = ",r2 | |
ENDRUN |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment