  We propose a simple approach to optimally select the number of control units
in k nearest neighbors (kNN) algorithm focusing in minimizing the mean squared
error for the average treatment effects. Our approach is non-parametric where
confidence intervals for the treatment effects were calculated using asymptotic
results with bias correction. Simulation exercises show that our approach gets
relative small mean squared errors, and a balance between confidence intervals
length and type I error. We analyzed the average treatment effects on treated
(ATET) of participation in 401(k) plans on accumulated net financial assets
confirming significant effects on amount and positive probability of net asset.
Our optimal k selection produces significant narrower ATET confidence intervals
compared with common practice of using k=1.
