Skip to main content
. Author manuscript; available in PMC: 2016 Jan 28.
Published in final edited form as: J R Stat Soc Series B Stat Methodol. 2015 Feb 15;78(1):127–151. doi: 10.1111/rssb.12107
Algorithm 1: Computing the Locally Efficient Score Function
The first two steps are done only once.
  • Posit a model for η2(ε, x) which has mean zero, and calculate (5), calling the result S*(X, Y, D). Use S*(·) in place of S(·) in (6)-(7).

  • Estimate fX|D(x, d) by a kernel density estimate among the data with Di = d, with result x|D(x, d).


The rest of the steps are done iteratively in the estimation algorithm.
  • Solve π^0=i=1NH(0,Xi,Yi){N0H(0,Xi,Yi)/π^0+N1H(1,Xi,Yi)/(1π^0)}1 to obtain π̂0 and set π̂1 = 1 − π̂0.

  • In the definition of κ(x, y) in (6), form κ̂(x, y) by replacing πd by π̂d. Define κ̂i = κ̂(Xi, Yi).

  • Define di = D|X, Y(d, Xi, Yi) = NdH(d, Xi, Yi)κ̂i/(Nπ̂d).

  • For any function h(d, x, y) in (6), estimate E{h(D, X, Y) | X, D = d) by nonparametric regression among observations with Di = d.

  • For any function h(d, x, y) in (6), estimate E{h(D, X, Y) | D = d) as E^{h(D,X,Y)|D=d)=i=1Nh(d,Xi,Yi)f^di/i=1Nf^di.

  • For any function h(d, x, y) in (6), estimate E{h(D, Y, X)|ε, X} by E^{h(D,Y,X)|ε,X}=d=01NdH(d,X,Y)h(d,Y,X)κ^(X,Y)/(Nπ^d).

  • For any function h(d, x, y) in (6), estimate Etrue{h(D, X, Y) | X) by E^true{h(D,X,Y)|X)=d=01π^dE^{h(d,X,Y)|X,D=d)f^X|D(X,d)/d=01π^df^X|D(X,d).

Application to the terms in (6) yields ĝ(εi, Xi) and d, and we then form S^eff(D,Xi,Yi)=S(X,Y,D)g^(ε,X)(1D)v^0Dv^1.
We have described the algorithm when X is continuous. When X is discrete, one simply replaces the density estimators and various nonparametric regressions with the corresponding averages associated with the different x values.