<s> from __future__ import print_function <EOL> import numpy as np <EOL> from scipy import stats <EOL> from statsmodels . distributions . mixture_rvs import mixture_rvs <EOL> from statsmodels . nonparametric . kde import kdensityfft <EOL> import matplotlib . pyplot as plt <EOL> np . random . seed ( <NUM_LIT> ) <EOL> obs_dist = mixture_rvs ( [ <NUM_LIT> , <NUM_LIT> ] , size = <NUM_LIT> , dist = [ stats . norm , stats . norm ] , <EOL> kwargs = ( dict ( loc = - <NUM_LIT:1> , scale = <NUM_LIT> ) , dict ( loc = <NUM_LIT:1> , scale = <NUM_LIT> ) ) ) <EOL> f_hat , grid , bw = kdensityfft ( obs_dist , kernel = "<STR_LIT>" , bw = "<STR_LIT>" ) <EOL> plt . figure ( ) <EOL> plt . hist ( obs_dist , bins = <NUM_LIT:50> , normed = True , color = '<STR_LIT>' ) <EOL> plt . plot ( grid , f_hat , lw = <NUM_LIT:2> , color = '<STR_LIT>' ) <EOL> plt . show ( ) <EOL> from statsmodels . nonparametric import bandwidths <EOL> bw = bandwidths . bw_scott ( obs_dist ) </s>
