Inform me () when using this script or encorporating it in a library.
Source code of jackknife.pro:
;+
; NAME:
; JACKKNIFE
; PURPOSE:
; Applies the jackknife estimator to a user-defined function and
; array to which the function is applied.
; CALLING SEQUENCE:
; JACKKNIFE, array, fct=fct[, val=val]
; EXAMPLES:
; dy = jackknife(x, fct='median', val=y)
; Applies the median function to the array x, where y is the
; median and dy is the one sigma jackknife uncertainty
; KEYWORDS:
; array = the array to which the estimator is applied
; fct = the user-defined function, which accepts only one
; parameter as input
; val = value of the function as applied to the entire array
; MODIFICATION HISTORY:
; Before 05/06/2007 Written by Eduard Westra
;-
FUNCTION jackknife, data, fct=fct, val=val
IF N_ELEMENTS(data) LE 2 THEN BEGIN
message, /info, 'Too few datapoints as input for a jackknife'
RETURN, 0d
ENDIF
nData = N_ELEMENTS(data)
jResult = DBLARR(nData)
val = CALL_FUNCTION(fct, data)
FOR i = 0UL, nData - 1 DO BEGIN
rdx = UNMATCH(i, nData)
jResult[i] = CALL_FUNCTION(fct, data[rdx])
ENDFOR
sjResult2 = TOTAL((jResult - (TOTAL(jResult)/DOUBLE(nData)))^2) * DOUBLE(nData - 1) / DOUBLE(nData)
RETURN, SQRT(sjResult2)
END