#NEWLINE# def MakeNormalModel( weights ) : #NEWLINE# #INDENT# 'Plot the CDF of birthweights with a normal model.' #NEWLINE# ( mu , var ) = thinkstats2 . TrimmedMeanVar ( weights , p = 0.01 ) #NEWLINE# print ( 'Mean, Var' , mu , var ) #NEWLINE# sigma = math . sqrt ( var ) #NEWLINE# print ( 'Sigma' , sigma ) #NEWLINE# ( xs , ps ) = thinkstats2 . RenderNormalCdf ( mu , sigma , low = 0 , high = 12.5 ) #NEWLINE# thinkplot . Plot ( xs , ps , label = 'model' , color = '0.8' ) #NEWLINE# cdf = thinkstats2 . Cdf ( weights , label = 'data' ) #NEWLINE# thinkplot . PrePlot ( 1 ) #NEWLINE# thinkplot . Cdf ( cdf ) #NEWLINE# thinkplot . Save ( root = 'analytic_birthwgt_model' , title = 'Birth weights' , xlabel = 'birth weight (lbs)' , ylabel = 'CDF' )