Demo entry 6770251

jk

   

Submitted by anonymous on Nov 12, 2018 at 11:08
Language: Python 3. Code size: 1.2 kB.

def getJackknifeF4(blockValuesA, blockSizesA, blockValuesB, blockSizesB, blockSizeUnion):
    thetaminus=[0 for x in range(len(blockSizeUnion))]
    sum1=0
    sum2=0
    jackknifeStdErr=0
    if sum(blockSizeUnion)==0:
        thetahat=0
    else:
        thetahat=sum(blockValuesB)/sum(blockSizesB) - sum(blockValuesA)/sum(blockSizesA)
    for c in range(len(blockSizeUnion)):
        if blockSizeUnion[c]==sum(blockSizeUnion):
            thetaminus[c]=0
        else:
            thetaminus[c]=((sum(blockValuesB)-blockValuesB[c])/(sum(blockSizesB)-blockSizesB[c])) - ((sum(blockValuesA)-blockValuesA[c])/(sum(blockSizesA)-blockSizesA[c]))
        sum1+=thetahat-thetaminus[c]
        if sum(blockSizeUnion)!=0:
            sum2+=(blockSizeUnion[c]*thetaminus[c])/sum(blockSizeUnion)
    jackknifeEstimator=sum1+sum2
    for c in range(len(blockSizeUnion)):
        if blockSizeUnion[c]!=0:
            hj=sum(blockSizeUnion)/blockSizeUnion[c]
            pseudoval=(hj*thetahat)-((hj-1)*thetaminus[c])
            try:
                jackknifeStdErr+=(1/len(blockSizeUnion))*(((pseudoval-jackknifeEstimator)**2)/(hj-1))
            except:
                pass
    return (jackknifeEstimator,jackknifeStdErr)

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).