Module Expr Str ImportFrom alias Import alias identifier Import alias identifier ImportFrom alias Assign NameStore Call AttributeLoad NameLoad attr ListLoad ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num Assign NameStore Call AttributeLoad NameLoad attr ListLoad Num Num Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr keyword Num Assign NameStore ListLoad ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num Assign NameStore SubscriptLoad AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr ExtSlice Index NameLoad Slice Slice Assign NameStore ListLoad Num Num Num Num Assign NameStore ListLoad Num Num Num Num Assign NameStore ListComp Call AttributeLoad NameLoad attr NameLoad comprehension NameStore NameLoad Expr Call NameLoad NameLoad NameLoad keyword Num Expr Call NameLoad NameLoad Expr Call NameLoad Str Expr Call NameLoad Call AttributeLoad Call AttributeLoad CompareLt NameLoad Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num attr Num attr Num Expr Call NameLoad Call AttributeLoad Call AttributeLoad CompareLt SubscriptLoad NameLoad ExtSlice Ellipsis Index NameLoad NameLoad attr Num attr Num Expr Call NameLoad Call AttributeLoad NameLoad attr Lambda arguments args NameParam defaults Call AttributeLoad CompareLt NameLoad SubscriptLoad NameLoad Index Num attr Num keyword Num Expr Call NameLoad Call AttributeLoad NameLoad attr Lambda arguments args NameParam defaults Call AttributeLoad CompareLt SubscriptLoad NameLoad ExtSlice Ellipsis Index NameLoad NameLoad attr Num keyword Num Assign NameStore Call AttributeLoad NameLoad attr Expr Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr keyword Num Expr Call NameLoad AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num keyword Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword Num Expr Call NameLoad AttributeLoad NameLoad attr NameLoad keyword Num Expr Call NameLoad Call AttributeLoad NameLoad attr Num Call AttributeLoad NameLoad attr Num keyword Num Assign NameStore Call AttributeLoad NameLoad attr Expr Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr keyword Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword Num Expr Call NameLoad AttributeLoad NameLoad attr NameLoad keyword Num Expr Call NameLoad Call AttributeLoad NameLoad attr Num Call AttributeLoad NameLoad attr Num keyword Num Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr ListLoad Num Num Expr Call NameLoad AttributeLoad NameLoad attr Expr Call NameLoad AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr ListLoad Num Num ListLoad Num Expr Call NameLoad AttributeLoad NameLoad attr Expr Call NameLoad AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr ListLoad Num ListLoad Num Num Expr Call NameLoad AttributeLoad NameLoad attr Expr Call NameLoad AttributeLoad NameLoad attr Import alias identifier Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad NameLoad ExtSlice Slice Index Num Call AttributeLoad NameLoad attr SubscriptLoad NameLoad ExtSlice Slice Slice Num keyword NameLoad Assign NameStore Call AttributeLoad NameLoad attr Expr Call NameLoad Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad NameLoad attr ListLoad Num Num Num Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr ListLoad Num ListLoad Num Num Expr Call NameLoad AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr ListLoad Num ListLoad Num Num Expr Call NameLoad Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad NameLoad attr ListLoad Num Num Num Expr Call NameLoad AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Num Assign NameStore Call AttributeLoad NameLoad attr keyword Num Expr Call NameLoad AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad keyword Num keyword Num Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Expr Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr keyword Num Expr Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr keyword Num Expr Call NameLoad Call AttributeLoad NameLoad attr Num AttributeLoad NameLoad attr keyword Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword Num Expr Call NameLoad AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num keyword Num Expr Call NameLoad AttributeLoad NameLoad attr NameLoad keyword Num Expr Call NameLoad AttributeLoad NameLoad attr NameLoad keyword Num Expr Call NameLoad AttributeLoad NameLoad attr NameLoad keyword Num Assign NameStore ListLoad Num Num Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call NameLoad NameLoad Expr Call NameLoad Call AttributeLoad Call AttributeLoad CompareLt NameLoad Call AttributeLoad NameLoad attr NameLoad attr Num attr Num Expr Call NameLoad Str Num Expr Call NameLoad Str Num Expr Call NameLoad Str BinOpSub NameLoad Num Assign NameStore ListLoad Num Num Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call NameLoad NameLoad Expr Call NameLoad Call AttributeLoad Call AttributeLoad CompareLt NameLoad Call AttributeLoad NameLoad attr NameLoad attr Num attr Num Expr Call NameLoad Str Num Expr Call NameLoad Str Num Expr Call NameLoad Str BinOpSub NameLoad Num Expr Call NameLoad NameLoad Num keyword Num Expr Call NameLoad NameLoad Num keyword Num Import alias identifier Assign NameStore Call AttributeLoad NameLoad attr ListLoad Num Num Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad BinOpDiv NameLoad Num Num Assign NameStore Call AttributeLoad NameLoad attr ListLoad Num Num Num ListLoad NameLoad NameLoad Num Assign NameStore Call AttributeLoad NameLoad attr ListLoad Num Num Num ListLoad NameLoad NameLoad Num Import alias identifier Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Num Num Num Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad ExtSlice Slice Index Num SubscriptLoad NameLoad ExtSlice Slice Index Num Str keyword Num Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Num Num Num Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad ExtSlice Slice Index Num SubscriptLoad NameLoad ExtSlice Slice Index Num Str keyword Num Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Num Num Num Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad ExtSlice Slice Index Num SubscriptLoad NameLoad ExtSlice Slice Index Num Str keyword Num Expr Call AttributeLoad NameLoad attr Str
N/A N/A examples for multivariate normal and t distributions


Created on Fri Jun 03 16:00:26 2011

@author: josef


for comparison I used R mvtnorm version 0.9-96

 __future__ print_function N/A numpy np N/A statsmodels.sandbox.distributions.mv_normal mvd numpy.testing assert_array_almost_equal N/A cov3 N/A N/A np array N/A N/A 1.0 0.5 0.75 N/A 0.5 1.5 0.6 N/A 0.75 0.6 2.0 N/A mu N/A N/A np array N/A -1 0.0 2.0 N/A mvn3 N/A N/A mvd MVNormal mu cov3 N/A x N/A N/A mvn3 rvs size 1000000 N/A xli N/A N/A 2.0 1.0 1.5 N/A 0.0 2.0 1.5 N/A 1.5 1.0 2.5 N/A 0.0 1.0 1.5 N/A xliarr N/A N/A N/A N/A np asarray xli T N/A N/A None N/A N/A N/A r_cdf N/A 0.3222292 0.3414643 0.5450594 0.3116296 N/A r_cdf_errors N/A 1.715116e-05 1.590284e-05 5.356471e-05 3.567548e-05 N/A n_cdf N/A N/A N/A mvn3 cdf a N/A a xli N/A N/A assert_array_almost_equal r_cdf n_cdf decimal 4 N/A N/A print n_cdf N/A N/A print N/A N/A print N/A N/A N/A N/A N/A x N/A N/A np array N/A xli N/A 0 all -1 mean 0 N/A N/A print N/A N/A N/A N/A N/A N/A x N/A N/A N/A None xliarr all 1 mean 0 N/A N/A print N/A N/A mvn3 expect_mc N/A N/A N/A x N/A N/A N/A N/A x N/A xli N/A 0 all -1 size 100000 N/A N/A print N/A N/A mvn3 expect_mc N/A N/A N/A x N/A N/A N/A N/A N/A x N/A N/A N/A None xliarr all 1 size 100000 N/A mvn3n N/A N/A mvn3 normalized N/A N/A assert_array_almost_equal N/A mvn3n cov N/A mvn3n corr decimal 15 N/A N/A assert_array_almost_equal N/A mvn3n mean N/A N/A np zeros 3 decimal 15 N/A xn N/A N/A mvn3 normalize x N/A xn_cov N/A N/A np cov xn rowvar 0 N/A N/A assert_array_almost_equal N/A mvn3n cov xn_cov decimal 2 N/A N/A assert_array_almost_equal N/A N/A np zeros 3 N/A N/A xn mean 0 decimal 2 N/A mvn3n2 N/A N/A mvn3 normalized2 N/A N/A assert_array_almost_equal N/A mvn3n cov N/A mvn3n2 cov decimal 2 N/A xs N/A N/A mvn3 standardize x N/A xs_cov N/A N/A np cov xn rowvar 0 N/A N/A assert_array_almost_equal N/A mvn3 corr xs_cov decimal 2 N/A N/A assert_array_almost_equal N/A N/A np zeros 3 N/A N/A xs mean 0 decimal 2 N/A mv2m N/A N/A mvn3 marginal N/A N/A np array N/A 0 1 N/A N/A print N/A mv2m mean N/A N/A print N/A mv2m cov N/A mv2c N/A N/A mvn3 conditional N/A N/A np array N/A 0 1 N/A 0 N/A N/A print N/A mv2c mean N/A N/A print N/A mv2c cov N/A mv2c N/A N/A mvn3 conditional N/A N/A np array N/A 0 N/A 0 0 N/A N/A print N/A mv2c mean N/A N/A print N/A mv2c cov N/A statsmodels.api sm N/A mod N/A N/A sm OLS N/A x N/A N/A N/A 0 N/A N/A sm add_constant N/A x N/A N/A N/A 1 prepend True N/A res N/A N/A mod fit N/A N/A print N/A N/A N/A res model predict N/A N/A np array N/A 1 0 0 N/A mv2c N/A N/A mvn3 conditional N/A N/A np array N/A 0 N/A 0 0 N/A N/A print N/A mv2c mean N/A mv2c N/A N/A mvn3 conditional N/A N/A np array N/A 0 N/A 1 1 N/A N/A print N/A N/A N/A res model predict N/A N/A np array N/A 1 1 1 N/A N/A print N/A mv2c mean N/A mvt3 N/A N/A mvd MVT mu cov3 4 N/A xt N/A N/A mvt3 rvs size 100000 N/A N/A assert_array_almost_equal N/A mvt3 cov N/A N/A np cov xt rowvar 0 decimal 1 N/A mvt3s N/A N/A mvt3 standardized N/A mvt3n N/A N/A mvt3 normalized N/A N/A assert_array_almost_equal N/A mvt3 corr N/A mvt3n sigma decimal 15 N/A N/A assert_array_almost_equal N/A mvt3n corr N/A mvt3n sigma decimal 15 N/A N/A assert_array_almost_equal N/A N/A np eye 3 N/A mvt3s sigma decimal 15 N/A xts N/A N/A mvt3 standardize xt N/A xts_cov N/A N/A np cov xts rowvar 0 N/A xtn N/A N/A mvt3 normalize xt N/A xtn_cov N/A N/A np cov xtn rowvar 0 N/A xtn_corr N/A N/A np corrcoef xtn rowvar 0 N/A N/A assert_array_almost_equal N/A mvt3n mean N/A N/A xtn mean 0 decimal 2 N/A N/A assert_array_almost_equal N/A mvt3n corr xtn_corr decimal 1 N/A N/A assert_array_almost_equal N/A mvt3n cov xtn_cov decimal 1 N/A N/A assert_array_almost_equal N/A mvt3s cov xts_cov decimal 1 N/A a N/A 0.0 1.0 1.5 N/A mvt3_cdf0 N/A N/A mvt3 cdf a N/A N/A print mvt3_cdf0 N/A N/A print N/A N/A N/A N/A N/A xt N/A N/A np array a all -1 mean 0 N/A N/A print R 0.3026741 N/A N/A print R 0.3026855 N/A N/A print diff N/A mvt3_cdf0 0.3026855 N/A a N/A 0.0 0.5 1.0 N/A mvt3_cdf1 N/A N/A mvt3 cdf a N/A N/A print mvt3_cdf1 N/A N/A print N/A N/A N/A N/A N/A xt N/A N/A np array a all -1 mean 0 N/A N/A print R 0.1946621 N/A N/A print R 0.1946217 N/A N/A print diff N/A mvt3_cdf1 0.1946217 N/A N/A assert_array_almost_equal mvt3_cdf0 0.3026855 decimal 5 N/A N/A assert_array_almost_equal mvt3_cdf1 0.1946217 decimal 5 N/A statsmodels.distributions.mixture_rvs mix N/A mu2 N/A N/A np array N/A 4 2.0 2.0 N/A mvn32 N/A N/A mvd MVNormal mu2 N/A cov3 2.0 4 N/A md N/A N/A mix mv_mixture_rvs N/A 0.4 0.6 5 N/A mvt3 mvt3n 3 N/A rvs N/A N/A mix mv_mixture_rvs N/A 0.4 0.6 2000 N/A mvn3 mvn32 3 N/A matplotlib.pyplot plt N/A fig N/A N/A plt figure N/A N/A N/A fig add_subplot 2 2 1 N/A N/A N/A plt plot N/A rvs N/A N/A N/A 0 N/A rvs N/A N/A N/A 1 . alpha 0.25 N/A N/A N/A plt title 1 versus 0 N/A N/A N/A fig add_subplot 2 2 2 N/A N/A N/A plt plot N/A rvs N/A N/A N/A 0 N/A rvs N/A N/A N/A 2 . alpha 0.25 N/A N/A N/A plt title 2 versus 0 N/A N/A N/A fig add_subplot 2 2 3 N/A N/A N/A plt plot N/A rvs N/A N/A N/A 1 N/A rvs N/A N/A N/A 2 . alpha 0.25 N/A N/A N/A plt title 2 versus 1