Likelihood ratio theory has had tremendous success in parametric inference,
due to tile fundamental theory of Wilks. Yet, there is no general applicab
le approach for nonparametric inferences based on function estimation. Maxi
mum likelihood ratio test statistics in general may not exist in nonparamet
ric function estimation setting. Even if they exist, they are hard to find
and can not; be optimal as shown in this paper. We introduce the generalize
d likelihood statistics to overcome the drawbacks of nonparametric maximum
likelihood ratio statistics. A new S Wilks phenomenon is unveiled. We demon
strate that a class of the generalized likelihood statistics based on some
appropriate nonparametric estimators are asymptotically distribution free a
nd follow chi (2)-distributions under null hypotheses for a number of usefu
l hypotheses and a variety of useful models including Gaussian white noise
models, nonparametric regression models, varying coefficient models and gen
eralized varying coefficient models. We further demonstrate that generalize
d likelihood ratio statistics are asymptotically optimal in the sense that
they achieve optimal rates of convergence given by Ingster. They can even b
e adaptively optimal in the sense of Spokoiny by using a simple choice of a
daptive smoothing parameter. Our work indicates that the generalized likeli
hood ratio statistics are indeed general and powerful for nonparametric tes
ting problems based on function estimation.