#NEWLINE# def smoothvar( self , xs , ys , x ) : #NEWLINE# #INDENT# '\n        Returns the kernel smoothing estimate of the variance at point x.\n        ' #NEWLINE# ( xs , ys ) = self . in_domain ( xs , ys , x ) #NEWLINE# if ( len ( xs ) > 0 ) : #NEWLINE# #INDENT# fittedvals = np . array ( [ self . smooth ( xs , ys , x ) for xx in xs ] ) #NEWLINE# rs = square ( subtract ( ys , fittedvals ) ) #NEWLINE# w = np . sum ( square ( subtract ( 1.0 , square ( divide ( subtract ( xs , x ) , self . h ) ) ) ) ) #NEWLINE# v = np . sum ( multiply ( rs , square ( subtract ( 1 , square ( divide ( subtract ( xs , x ) , self . h ) ) ) ) ) ) #NEWLINE# return ( v / w ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return np . nan