code: def NEES(xs, est_xs, ps):
      """
      Computes the normalized estimated error squared (NEES) test on a sequence
      of estimates. The estimates are optimal if the mean error is zero and
      the covariance matches the Kalman filter's covariance. If this holds,
      then the mean of the NEES should be equal to or less than the dimension
      of x.
  
      Examples
      --------
  
      .. code-block: Python
  
          xs = ground_truth()
          est_xs, ps, _, _ = kf.batch_filter(zs)
          NEES(xs, est_xs, ps)
  
      Parameters
      ----------
  
      xs : list-like
          sequence of true values for the state x
  
      est_xs : list-like
          sequence of estimates from an estimator (such as Kalman filter)
  
      ps : list-like
          sequence of covariance matrices from the estimator
  
      Returns
      -------
  
      errs : list of floats
         list of NEES computed for each estimate
  
      """
  
      est_err = xs - est_xs
      errs = []
      for x, p in zip(est_err, ps):
          errs.append(np.dot(x.T, linalg.inv(p)).dot(x))
      return errs
  
imports: from __future__ import absolute_import, division, unicode_literals
  import math
  from math import cos, sin
  import random
  import warnings
  import numpy
  from numpy.linalg import inv
  import scipy.linalg
  import scipy.sparse
  import scipy.sparse.linalg
  from scipy.stats import norm, multivariate_normal
label_desc: Use image node_id 25 for calling a global function with example usage: NEES(xs, est_xs, ps) and returns: errs