/usr/share/ferret-vis/jnls/go/regressz.jnl is in ferret-vis 6.9.3-4build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | \CANCEL MODE VERIFY
! Description: define FERRET variables for regression along the Z axis
! updated 10/93 for Ferret V3.01
say ... Linear Regression Along the Z Axis
say ... Instructions:
say Use the LET command to define new variables
say Define the variable P as your independent (X) variable
say Define the variable Q as your dependent (Y) variable
say Results will be variables "SLOPE", "INTERCEP" and "RSQUARE"
say QHAT will be the regression estimate
say Note: If "Z" is your independent variable then
say ... "SET GRID Q" after defining Q.
say ...
let pq = p*q
let pqmask = pq-pq ! 0 or "missing" so all variables share the same missing
let pmasked = p + pqmask
let qmasked = q + pqmask
let pp = pmasked*pmasked
let qq = qmasked*qmasked
let pave = pmasked[z=@ave]
let qave = qmasked[z=@ave]
let pdev=pmasked-pave
let qdev=qmasked-qave
let pdevqdev=pdev*qdev
let pqvar=pdevqdev[z=@ave]
let pvar=pmasked[z=@var]
let qvar=qmasked[z=@var]
let slope = pqvar / pvar
let intercep = qave - slope*pave
let qhat = slope*p + intercep
let rsquare = (pqvar*pqvar) / (pvar*qvar)
SET MODE/LAST VERIFY
|