Module Expr Str ImportFrom alias alias alias Import alias identifier ImportFrom alias ImportFrom alias ImportFrom alias Assign NameStore NameLoad TryExcept body ImportFrom alias handlers ExceptHandler type NameLoad body Assign NameStore NameLoad Assign NameStore Dict Str Str Str Str Str Str Str Str Str Str FunctionDef arguments args NameParam defaults body Assign TupleStore NameStore NameStore Call NameLoad ListComp TupleLoad AttributeLoad NameLoad attr NameLoad comprehension TupleStore NameStore NameStore Call NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Str Return TupleLoad NameLoad NameLoad NameLoad decorator_list Assign NameStore NameLoad TryExcept body ImportFrom alias handlers ExceptHandler type NameLoad body Assign NameStore NameLoad Assign NameStore Dict Str Str Str Str AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Dict Str Str Str Str AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Dict Str Str Str Str AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr If NameLoad body Assign NameStore Dict Str Str Str Str AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Dict Str Str Str Str AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore NameLoad If Call NameLoad NameLoad NameLoad body Assign NameStore NameLoad Assign NameStore Num Assign NameStore NameLoad orelse Assign NameStore BinOpSub Call NameLoad NameLoad Num If CompareLt NameLoad Num body Raise Call NameLoad Str If BoolOpOr Call NameLoad NameLoad NameLoad Call NameLoad NameLoad NameLoad body TryExcept body Assign NameStore Call NameLoad SubscriptLoad NameLoad Index Num handlers ExceptHandler type NameLoad body Assign NameStore Num If CompareEq NameLoad Num body Assign NameStore Call AttributeLoad NameLoad attr NameLoad orelse If CompareEq SubscriptLoad NameLoad Index Num Num body Assign SubscriptStore NameLoad Index Num Call AttributeLoad NameLoad attr NameLoad Assign NameStore NameLoad orelse Assign NameStore Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr TupleLoad BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad keyword AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr BinOpMult BinOpSub NameLoad Num NameLoad Assign NameStore TupleLoad SubscriptLoad NameLoad Index Num BinOpAdd SubscriptLoad NameLoad Index Num NameLoad Assign SubscriptStore NameLoad Index NameLoad Num If BoolOpAnd CompareIsNot NameLoad NameLoad CompareGt NameLoad Num body If CompareEq NameLoad Num body Assign SubscriptStore NameLoad ExtSlice Slice Index Num BinOpDiv UnaryOpUSub SubscriptLoad NameLoad Slice Num SubscriptLoad NameLoad Index Num orelse If NameLoad body For NameStore Call NameLoad NameLoad body Assign SubscriptStore NameLoad ExtSlice Slice BinOpMult NameLoad NameLoad BinOpMult BinOpAdd NameLoad Num NameLoad Slice NameLoad UnaryOpUSub AttributeLoad SubscriptLoad NameLoad Index BinOpAdd NameLoad Num attr orelse Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr SubscriptLoad NameLoad Index Num For NameStore Call NameLoad NameLoad body Assign SubscriptStore NameLoad ExtSlice Slice BinOpMult NameLoad NameLoad BinOpMult BinOpAdd NameLoad Num NameLoad Slice NameLoad UnaryOpUSub AttributeLoad Call AttributeLoad NameLoad attr NameLoad SubscriptLoad NameLoad Index BinOpAdd NameLoad Num attr Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults Num NameLoad Num body Expr Str Assign NameStore Call NameLoad NameLoad NameLoad Assign NameStore IfExp UnaryOpNot NameLoad Call AttributeLoad NameLoad attr NameLoad NameLoad If CompareIsNot NameLoad NameLoad body While CompareGt NameLoad Num body If UnaryOpNot NameLoad body Assign NameStore BinOpSub SubscriptLoad NameLoad Slice NameLoad SubscriptLoad NameLoad Slice UnaryOpUSub NameLoad orelse Assign NameStore SubscriptLoad Call AttributeLoad NameLoad attr NameLoad Slice NameLoad AugAssignSub NameStore Num If UnaryOpNot NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad keyword Num orelse While CompareGt NameLoad Num body Assign NameStore SubscriptLoad Call AttributeLoad NameLoad attr Slice Num AugAssignSub NameStore Num Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults Num body Expr Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Call NameLoad NameLoad Return Call AttributeLoad NameLoad attr CompareLt Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad AttributeLoad NameLoad attr Index Num If UnaryOpNot NameLoad body Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr attr Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr BinOpAdd NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr BinOpSub NameLoad NameLoad NameLoad Assign NameStore BinOpMult Num Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpAdd NameLoad NameLoad NameLoad NameLoad Return Call NameLoad Call AttributeLoad Call AttributeLoad NameLoad attr attr NameLoad UnaryOpUSub NameLoad orelse Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr BinOpAdd NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr BinOpSub NameLoad NameLoad NameLoad Assign NameStore BinOpMult Num Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpAdd NameLoad NameLoad NameLoad NameLoad Return Call NameLoad Call AttributeLoad NameLoad attr NameLoad UnaryOpUSub NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index Num Assign NameStore Call AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad keyword AttributeLoad NameLoad attr Assign NameStore BinOpDiv NameLoad BinOpPow BinOpAdd Num BinOpPow NameLoad Num Num For NameStore Call NameLoad NameLoad body For NameStore Call NameLoad NameLoad body Assign SubscriptStore NameLoad Index TupleLoad NameLoad NameLoad BinOpAdd SubscriptLoad NameLoad Index TupleLoad BinOpSub NameLoad Num NameLoad BinOpMult SubscriptLoad NameLoad Index NameLoad SubscriptLoad NameLoad Index TupleLoad BinOpSub NameLoad Num BinOpSub BinOpSub NameLoad NameLoad Num Assign SubscriptStore NameLoad Index TupleLoad NameLoad NameLoad SubscriptLoad NameLoad Index NameLoad Return UnaryOpUSub SubscriptLoad NameLoad ExtSlice Index BinOpSub NameLoad Num Slice decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index Num Assign NameStore Call AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad keyword AttributeLoad NameLoad attr Assign SubscriptStore NameLoad Slice BinOpSub NameLoad Num UnaryOpUSub NameLoad For NameStore Call NameLoad BinOpSub NameLoad Num Num Num body For NameStore Call NameLoad NameLoad body Assign SubscriptStore NameLoad Index TupleLoad BinOpSub NameLoad Num NameLoad BinOpDiv BinOpSub SubscriptLoad NameLoad Index TupleLoad NameLoad NameLoad BinOpMult SubscriptLoad NameLoad Index TupleLoad NameLoad NameLoad SubscriptLoad NameLoad Index TupleLoad NameLoad BinOpSub BinOpSub NameLoad NameLoad Num BinOpSub Num BinOpPow SubscriptLoad NameLoad Index TupleLoad NameLoad NameLoad Num Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore BinOpDiv NameLoad BinOpPow BinOpSub Num BinOpPow NameLoad Num Num Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad NameLoad body Expr Str ImportFrom alias Assign NameStore ListLoad If CompareIs NameLoad NameLoad body Assign NameStore Call NameLoad NameLoad If CompareIs NameLoad NameLoad body Assign NameStore SubscriptLoad AttributeLoad SubscriptLoad NameLoad Index Num attr Index Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad For NameStore Call NameLoad NameLoad body Assign NameStore SubscriptLoad NameLoad Index NameLoad Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr BinOpAdd NameLoad Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr keyword NameLoad Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad NameLoad keyword NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad body Expr Str ImportFrom alias If CompareIs NameLoad NameLoad body Assign NameStore Call NameLoad NameLoad If CompareIs NameLoad NameLoad body Assign NameStore SubscriptLoad AttributeLoad SubscriptLoad NameLoad Index Num attr Index Num If UnaryOpNot NameLoad body Assign NameStore NameLoad Assign NameStore BinOpMult Call AttributeLoad NameLoad attr NameLoad BinOpPow BinOpAdd NameLoad NameLoad Num Assign NameStore ListLoad NameLoad Assign NameStore ListLoad NameLoad Assign NameStore ListLoad NameLoad Assign NameStore ListLoad Assign NameStore ListLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword NameLoad Assign NameStore ListLoad NameLoad Assign NameStore ListLoad NameLoad For NameStore Call NameLoad NameLoad body Assign NameStore NameLoad Assign NameStore NameLoad Assign NameStore ListLoad Assign NameStore ListLoad Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index NameLoad AttributeLoad SubscriptLoad NameLoad Index NameLoad attr keyword NameLoad keyword Str Assign SubscriptStore NameLoad Index Num Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index NameLoad AttributeLoad SubscriptLoad NameLoad Index Num attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index NameLoad SubscriptLoad NameLoad Index NameLoad keyword NameLoad keyword Str Assign SubscriptStore NameLoad Index Num Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index NameLoad AttributeLoad SubscriptLoad NameLoad Index Num attr Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index NameLoad Expr Call AttributeLoad NameLoad attr AttributeLoad Call AttributeLoad NameLoad attr attr For NameStore Call NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad BinOpSub SubscriptLoad NameLoad Index NameLoad Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index BinOpSub NameLoad BinOpAdd NameLoad Num Expr Call AttributeLoad NameLoad attr NameLoad BinOpSub SubscriptLoad NameLoad Index NameLoad Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index BinOpSub NameLoad BinOpAdd NameLoad Num AugAssignAdd SubscriptStore NameLoad Index BinOpAdd NameLoad Num Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index BinOpAdd NameLoad Num AttributeLoad SubscriptLoad NameLoad Index BinOpSub NameLoad BinOpAdd NameLoad Num attr Expr Call AttributeLoad NameLoad attr BinOpSub SubscriptLoad NameLoad Index NameLoad Call AttributeLoad NameLoad attr NameLoad AttributeLoad SubscriptLoad NameLoad Index NameLoad attr Expr Call AttributeLoad NameLoad attr BinOpSub SubscriptLoad NameLoad Index NameLoad Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index NameLoad SubscriptLoad NameLoad Index NameLoad AttributeLoad SubscriptLoad NameLoad Index NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index BinOpAdd NameLoad Num keyword NameLoad Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index BinOpAdd NameLoad Num keyword NameLoad Assign NameStore SubscriptLoad NameLoad Index Num If UnaryOpNot NameLoad body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad For NameStore Call NameLoad NameLoad body Assign SubscriptStore NameLoad Index NameLoad Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad SubscriptLoad NameLoad Index NameLoad NameLoad Return TupleLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad NameLoad body Expr Str Assign NameStore CompareEq Call NameLoad NameLoad NameLoad If UnaryOpNot NameLoad body Assign TupleStore NameStore NameStore AttributeLoad NameLoad attr AugAssignFloorDiv NameStore NameLoad Assign NameStore ListComp SubscriptLoad NameLoad ExtSlice Slice NameLoad Slice BinOpMult NameLoad NameLoad BinOpMult BinOpAdd NameLoad Num NameLoad comprehension NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad NameLoad Assign NameStore SubscriptLoad AttributeLoad SubscriptLoad NameLoad Index Num attr Index Num Assign NameStore Call NameLoad NameLoad NameLoad NameLoad Assign TupleStore NameStore NameStore Call NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad If UnaryOpNot NameLoad body Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr NameLoad keyword Num attr NameLoad BinOpMult NameLoad NameLoad Return TupleLoad NameLoad NameLoad decorator_list If NameLoad body FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad NameLoad body Assign NameStore CompareEq Call NameLoad NameLoad NameLoad If NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword Num Assign TupleStore NameStore NameStore AttributeLoad NameLoad attr AugAssignFloorDiv NameStore NameLoad If CompareLt NameLoad Num body Raise Call NameLoad Str If CompareLt NameLoad Num body Raise Call NameLoad Str If CompareIs NameLoad NameLoad body Assign TupleStore NameStore NameStore NameStore Call NameLoad ListLoad NameLoad NameLoad Assign NameStore SubscriptLoad NameLoad Index NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword NameLoad Assign NameStore Call SubscriptLoad NameLoad Index NameLoad NameLoad NameLoad NameLoad Assign TupleStore NameStore NameStore Call SubscriptLoad NameLoad Index NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword NameLoad If NameLoad body Assign NameStore ListComp SubscriptLoad NameLoad ExtSlice Slice NameLoad Slice BinOpMult NameLoad NameLoad BinOpMult BinOpAdd NameLoad Num NameLoad comprehension NameStore Call NameLoad NameLoad Return TupleLoad NameLoad NameLoad decorator_list Assign AttributeStore NameLoad attr AttributeLoad NameLoad attr orelse Assign NameStore NameLoad FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad NameLoad body Expr Str ImportFrom alias Assign NameStore ListLoad If CompareIs NameLoad NameLoad body Assign NameStore Call NameLoad NameLoad If CompareIs NameLoad NameLoad body Assign NameStore SubscriptLoad AttributeLoad SubscriptLoad NameLoad Index Num attr Index Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad For NameStore Call NameLoad NameLoad body Assign NameStore SubscriptLoad NameLoad Index NameLoad Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr BinOpSub NameLoad Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr keyword NameLoad Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad NameLoad keyword NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad If CompareEq AttributeLoad NameLoad attr Num body Assign NameStore SubscriptLoad NameLoad ExtSlice Slice Index AttributeLoad NameLoad attr AugAssignSub NameStore Call AttributeLoad NameLoad attr NameLoad keyword Num Assign TupleStore NameStore NameStore AttributeLoad NameLoad attr Assign NameStore ListLoad For NameStore Call NameLoad BinOpAdd NameLoad Num body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad For NameStore Call NameLoad BinOpSub NameLoad NameLoad body AugAssignAdd SubscriptStore NameLoad Index NameLoad Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index NameLoad SubscriptLoad NameLoad Index BinOpAdd NameLoad NameLoad AugAssignDiv SubscriptStore NameLoad Index NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad NameLoad body Expr Str ImportFrom alias If CompareEq Call NameLoad NameLoad NameLoad body Assign NameStore Call NameLoad NameLoad Assign NameStore SubscriptLoad AttributeLoad SubscriptLoad NameLoad Index Num attr Index Num orelse Assign TupleStore NameStore NameStore AttributeLoad NameLoad attr AugAssignFloorDiv NameStore NameLoad Assign NameStore ListComp SubscriptLoad NameLoad ExtSlice Slice NameLoad Slice BinOpMult NameLoad NameLoad BinOpMult BinOpAdd NameLoad Num NameLoad comprehension NameStore Call NameLoad NameLoad If CompareIs NameLoad NameLoad body Assign NameStore BinOpSub NameLoad Num Assign NameStore AttributeLoad Call NameLoad BinOpAdd ListLoad Num ListComp UnaryOpUSub SubscriptLoad NameLoad Index NameLoad comprehension NameStore Call NameLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign SubscriptStore NameLoad ExtSlice Slice NameLoad Slice NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore ListComp SubscriptLoad NameLoad ExtSlice Slice NameLoad Slice BinOpMult NameLoad NameLoad BinOpMult BinOpAdd NameLoad Num NameLoad comprehension NameStore Call NameLoad Call NameLoad NameLoad BinOpAdd NameLoad Num For NameStore Call NameLoad BinOpSub NameLoad BinOpSub NameLoad Num body Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad AugAssignAdd NameStore ListLoad SubscriptLoad NameLoad ExtSlice Slice NameLoad Slice UnaryOpUSub NameLoad If NameLoad body For NameStore Call NameLoad Call NameLoad NameLoad body Assign SubscriptStore NameLoad Index NameLoad AttributeLoad SubscriptLoad NameLoad Index NameLoad attr Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad NameLoad Return Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad NameLoad body Expr Str ImportFrom alias If CompareIs NameLoad NameLoad body Assign NameStore BinOpSub Call NameLoad NameLoad Num If CompareIs NameLoad NameLoad body Assign NameStore SubscriptLoad AttributeLoad SubscriptLoad NameLoad Index Num attr Index Num Assign NameStore ListLoad Assign NameStore ListLoad Assign NameStore ListLoad Assign NameStore ListLoad Assign NameStore ListLoad Assign NameStore ListLoad Assign NameStore ListLoad For NameStore Call NameLoad NameLoad body Assign NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad NameLoad Assign NameStore ListLoad Assign NameStore ListLoad Assign NameStore Call AttributeLoad SubscriptLoad NameLoad Index Num attr Assign NameStore Call AttributeLoad AttributeLoad SubscriptLoad NameLoad Index Num attr attr For NameStore Call NameLoad NameLoad body AugAssignSub NameStore Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index NameLoad SubscriptLoad NameLoad Index BinOpAdd NameLoad Num AugAssignSub NameStore Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index NameLoad AttributeLoad SubscriptLoad NameLoad Index BinOpAdd NameLoad Num attr Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index NameLoad keyword NameLoad Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index NameLoad keyword NameLoad If CompareEq NameLoad Num body Expr Call AttributeLoad NameLoad attr AttributeLoad Call AttributeLoad NameLoad attr TupleLoad SubscriptLoad NameLoad Index Num NameLoad SubscriptLoad NameLoad Index Num attr Expr Call AttributeLoad NameLoad attr AttributeLoad Call AttributeLoad NameLoad attr TupleLoad SubscriptLoad NameLoad Index Num NameLoad AttributeLoad SubscriptLoad NameLoad Index Num attr attr orelse Assign NameStore Call AttributeLoad AttributeLoad SubscriptLoad NameLoad Index BinOpAdd NameLoad Num attr attr For NameStore Call NameLoad NameLoad body AugAssignSub NameStore Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index NameLoad AttributeLoad SubscriptLoad NameLoad Index BinOpSub NameLoad NameLoad attr Expr Call AttributeLoad NameLoad attr AttributeLoad Call AttributeLoad NameLoad attr TupleLoad SubscriptLoad NameLoad Index NameLoad NameLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad NameLoad attr AttributeLoad Call AttributeLoad NameLoad attr TupleLoad SubscriptLoad NameLoad Index NameLoad NameLoad NameLoad attr For NameStore Call NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad BinOpSub SubscriptLoad NameLoad Index NameLoad Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index BinOpSub NameLoad BinOpAdd NameLoad Num Expr Call AttributeLoad NameLoad attr NameLoad BinOpSub SubscriptLoad NameLoad Index NameLoad Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index BinOpSub NameLoad BinOpAdd NameLoad Num Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index NameLoad Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index NameLoad SubscriptLoad NameLoad Index NameLoad keyword NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad NameLoad body Expr Str If CompareEq Call NameLoad NameLoad NameLoad body Assign NameStore Call NameLoad NameLoad Assign NameStore SubscriptLoad AttributeLoad SubscriptLoad NameLoad Index Num attr Index Num orelse Assign TupleStore NameStore NameStore AttributeLoad NameLoad attr AugAssignFloorDiv NameStore NameLoad Assign NameStore NameLoad Assign NameStore ListComp AttributeLoad NameLoad attr comprehension NameStore Call NameLoad NameLoad NameLoad keyword NameLoad Return Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str ImportFrom alias Assign NameStore CompareEq Call NameLoad NameLoad NameLoad If UnaryOpNot NameLoad body Assign TupleStore NameStore NameStore AttributeLoad NameLoad attr AugAssignFloorDiv NameStore NameLoad Assign NameStore ListComp SubscriptLoad NameLoad ExtSlice Slice NameLoad Slice BinOpMult NameLoad NameLoad BinOpMult BinOpAdd NameLoad Num NameLoad comprehension NameStore Call NameLoad NameLoad orelse Assign NameStore Call NameLoad NameLoad Assign NameStore SubscriptLoad AttributeLoad SubscriptLoad NameLoad Index Num attr Index Num Assign NameStore Call NameLoad NameLoad NameLoad NameLoad NameLoad Assign NameStore Call NameLoad NameLoad NameLoad NameLoad If UnaryOpNot NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword Num Return TupleLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad If CompareNotIn NameLoad ListLoad Num Num body Raise Call NameLoad BinOpMod Str TupleLoad NameLoad NameLoad If UnaryOpNot CompareEq SubscriptLoad NameLoad Index Num NameLoad body Raise Call NameLoad BinOpMod Str TupleLoad NameLoad NameLoad SubscriptLoad NameLoad Index Num If UnaryOpNot CompareEq SubscriptLoad NameLoad Index Num NameLoad body Raise Call NameLoad BinOpMod Str TupleLoad NameLoad NameLoad SubscriptLoad NameLoad Index Num If BoolOpAnd CompareIs NameLoad NameLoad UnaryOpNot BoolOpOr CompareEq NameLoad Num CompareEq SubscriptLoad NameLoad Index Num Num body Raise Call NameLoad BinOpMod Str NameLoad If BoolOpAnd CompareEq NameLoad Num CompareIsNot NameLoad NameLoad UnaryOpNot CompareIn SubscriptLoad NameLoad Index Num ListLoad Num NameLoad body Raise Call NameLoad BinOpMod Str TupleLoad NameLoad NameLoad Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad If CompareNotIn NameLoad ListLoad Num Num body Raise Call NameLoad BinOpMod Str TupleLoad NameLoad NameLoad If UnaryOpNot CompareEq SubscriptLoad NameLoad Index Num NameLoad body Raise Call NameLoad BinOpMod Str TupleLoad NameLoad NameLoad SubscriptLoad NameLoad Index Num If BoolOpAnd CompareIs NameLoad NameLoad UnaryOpNot BoolOpOr CompareEq NameLoad Num CompareEq SubscriptLoad NameLoad Index Num Num body Raise Call NameLoad BinOpMod Str NameLoad If BoolOpAnd CompareEq NameLoad Num UnaryOpNot CompareIn SubscriptLoad NameLoad Index Num ListLoad Num NameLoad body Raise Call NameLoad BinOpMod Str TupleLoad NameLoad NameLoad Call NameLoad NameLoad decorator_list
N/A N/A 
Statespace Tools

Author: Chad Fulton
License: Simplified-BSD
 __future__ division absolute_import print_function N/A numpy np scipy.linalg solve_sylvester statsmodels.tools.data _is_using_pandas N/A _statespace N/A has_find_best_blas_type True N/A N/A scipy.linalg.blas find_best_blas_type N/A N/A N/A ImportError N/A N/A has_find_best_blas_type False N/A _type_conv N/A f d F D G s d c z z find_best_blas_type N/A N/A arrays N/A N/A N/A N/A dtype index N/A max N/A N/A N/A ar dtype i N/A N/A i ar N/A enumerate arrays N/A prefix N/A N/A _type_conv get N/A dtype char d N/A N/A prefix dtype None N/A N/A has_trmm True N/A N/A scipy.linalg.blas dtrmm N/A N/A N/A ImportError N/A N/A has_trmm False N/A prefix_dtype_map N/A s d c z N/A np float32 N/A np float64 N/A np complex64 N/A np complex128 N/A prefix_statespace_map N/A s d c z N/A _statespace sStatespace N/A _statespace dStatespace N/A _statespace cStatespace N/A _statespace zStatespace N/A prefix_kalman_filter_map N/A s d c z N/A _statespace sKalmanFilter N/A _statespace dKalmanFilter N/A _statespace cKalmanFilter N/A _statespace zKalmanFilter N/A has_trmm N/A N/A prefix_pacf_map N/A s d c z N/A _statespace _scompute_coefficients_from_multivariate_pacf N/A _statespace _dcompute_coefficients_from_multivariate_pacf N/A _statespace _ccompute_coefficients_from_multivariate_pacf N/A _statespace _zcompute_coefficients_from_multivariate_pacf N/A prefix_sv_map N/A s d c z N/A _statespace _sconstrain_sv_less_than_one N/A _statespace _dconstrain_sv_less_than_one N/A _statespace _cconstrain_sv_less_than_one N/A _statespace _zconstrain_sv_less_than_one companion_matrix N/A N/A polynomial N/A N/A N/A 
    Create a companion matrix

    Parameters
    ----------
    polynomial : array_like or list
        If an iterable, interpreted as the coefficients of the polynomial from
        which to form the companion matrix. Polynomial coefficients are in
        order of increasing degree, and may be either scalars (as in an AR(p)
        model) or coefficient matrices (as in a VAR(p) model). If an integer,
        it is interpereted as the size of a companion matrix of a scalar
        polynomial, where the polynomial coefficients are initialized to zeros.
        If a matrix polynomial is passed, :math:`C_0` may be set to the scalar
        value 1 to indicate an identity matrix (doing so will improve the speed
        of the companion matrix creation).

    Returns
    -------
    companion_matrix : array

    Notes
    -----
    Given coefficients of a lag polynomial of the form:

    .. math::
        c(L) = c_0 + c_1 L + \dots + c_p L^p

    returns a matrix of the form

    .. math::
        \begin{bmatrix}
            \phi_1 & 1      & 0 & \cdots & 0 \\
            \phi_2 & 0      & 1 &        & 0 \\
            \vdots &        &   & \ddots & 0 \\
                   &        &   &        & 1 \\
            \phi_n & 0      & 0 & \cdots & 0 \\
        \end{bmatrix}

    where some or all of the :math:`\phi_i` may be non-zero (if `polynomial` is
    None, then all are equal to zero).

    If the coefficients provided are scalars :math:`(c_0, c_1, \dots, c_p)`,
    then the companion matrix is an :math:`n \times n` matrix formed with the
    elements in the first column defined as
    :math:`\phi_i = -\frac{c_i}{c_0}, i \in 1, \dots, p`.

    If the coefficients provided are matrices :math:`(C_0, C_1, \dots, C_p)`,
    each of shape :math:`(m, m)`, then the companion matrix is an
    :math:`nm \times nm` matrix formed with the elements in the first column
    defined as :math:`\phi_i = -C_0^{-1} C_i', i \in 1, \dots, p`.

    It is important to understand the expected signs of the coefficients. A
    typical AR(p) model is written as:

    .. math::
        y_t = a_1 y_{t-1} + \dots + a_p y_{t-p} + \varepsilon_t

    This can be rewritten as:

    .. math::
        (1 - a_1 L - \dots - a_p L^p )y_t = \varepsilon_t \\
        (1 + c_1 L + \dots + c_p L^p )y_t = \varepsilon_t \\
        c(L) y_t = \varepsilon_t

    The coefficients from this form are defined to be :math:`c_i = - a_i`, and
    it is the :math:`c_i` coefficients that this function expects to be
    provided.

     N/A identity_matrix False N/A N/A isinstance polynomial int N/A N/A n polynomial N/A m 1 N/A polynomial None N/A N/A n N/A N/A len polynomial 1 N/A N/A n 1 N/A N/A N/A ValueError Companion matrix polynomials must include at least two terms. N/A N/A N/A isinstance polynomial list N/A isinstance polynomial tuple N/A N/A N/A N/A m N/A len N/A polynomial N/A 1 N/A N/A N/A TypeError N/A N/A m 1 N/A N/A m 1 N/A N/A polynomial N/A N/A np asanyarray polynomial N/A N/A N/A N/A polynomial N/A 0 1 N/A N/A N/A polynomial N/A 0 N/A N/A np eye m N/A identity_matrix True N/A N/A m 1 N/A polynomial N/A N/A np asanyarray polynomial N/A matrix N/A N/A np zeros N/A N/A n m N/A n m dtype N/A N/A N/A np asanyarray polynomial dtype N/A idx N/A N/A np diag_indices N/A N/A n 1 m N/A idx N/A N/A idx N/A 0 N/A N/A idx N/A 1 m N/A N/A matrix N/A idx 1 N/A N/A N/A polynomial None N/A n 0 N/A N/A N/A m 1 N/A N/A N/A matrix N/A N/A N/A 0 N/A N/A N/A polynomial N/A 1 N/A polynomial N/A 0 N/A N/A identity_matrix N/A N/A i N/A range n N/A N/A N/A matrix N/A N/A N/A i m N/A N/A i 1 m N/A m N/A N/A N/A polynomial N/A N/A i 1 T N/A N/A inv N/A N/A N/A np linalg inv N/A polynomial N/A 0 N/A i N/A range n N/A N/A N/A matrix N/A N/A N/A i m N/A N/A i 1 m N/A m N/A N/A N/A N/A np dot inv N/A polynomial N/A N/A i 1 T N/A matrix N/A diff N/A N/A series k_diff k_seasonal_diff k_seasons N/A 1 None 1 N/A N/A 
    Difference a series simply and/or seasonally along the zero-th axis.

    Given a series (denoted :math:`y_t`), performs the differencing operation

    .. math::

        \Delta^d \Delta_s^D y_t

    where :math:`d =` `diff`, :math:`s =` `k_seasons`,
    :math:`D =` `seasonal\_diff`, and :math:`\Delta` is the difference
    operator.

    Parameters
    ----------
    series : array_like
        The series to be differenced.
    diff : int, optional
        The number of simple differences to perform. Default is 1.
    seasonal_diff : int or None, optional
        The number of seasonal differences to perform. Default is no seasonal
        differencing.
    k_seasons : int, optional
        The seasonal lag. Default is 1. Unused if there is no seasonal
        differencing.

    Returns
    -------
    differenced : array
        The differenced array.
     N/A pandas N/A _is_using_pandas series None N/A differenced N/A N/A pandas N/A N/A np asanyarray series series N/A N/A k_seasonal_diff None N/A N/A N/A k_seasonal_diff 0 N/A N/A N/A pandas N/A N/A differenced N/A N/A differenced N/A k_seasons N/A differenced N/A N/A k_seasons N/A N/A differenced N/A N/A N/A differenced diff k_seasons N/A k_seasons N/A k_seasonal_diff 1 N/A N/A pandas N/A N/A differenced N/A N/A np diff differenced k_diff axis 0 N/A N/A N/A k_diff 0 N/A N/A differenced N/A N/A N/A differenced diff N/A 1 N/A k_diff 1 N/A differenced N/A is_invertible N/A N/A polynomial threshold N/A 1.0 N/A N/A 
    Determine if a polynomial is invertible.

    Requires all roots of the polynomial lie inside the unit circle.

    Parameters
    ----------
    polynomial : array_like or tuple, list
        Coefficients of a polynomial, in order of increasing degree.
        For example, `polynomial=[1, -0.5]` corresponds to the polynomial
        :math:`1 - 0.5x` which has root :math:`2`. If it is a matrix
        polynomial (in which case the coefficients are coefficient matrices),
        a tuple or list of matrices should be passed.
    threshold : number
        Allowed threshold for `is_invertible` to return True. Default is 1.

    Notes
    -----

    If the coefficients provided are scalars :math:`(c_0, c_1, \dots, c_n)`,
    then the corresponding polynomial is :math:`c_0 + c_1 L + \dots + c_n L^n`.


    If the coefficients provided are matrices :math:`(C_0, C_1, \dots, C_n)`,
    then the corresponding polynomial is :math:`C_0 + C_1 L + \dots + C_n L^n`.

    There are three equivalent methods of determining if the polynomial
    represented by the coefficients is invertible:

    The first method factorizes the polynomial into:

    .. math::

        C(L) & = c_0 + c_1 L + \dots + c_n L^n \\
             & = constant (1 - \lambda_1 L)
                 (1 - \lambda_2 L) \dots (1 - \lambda_n L)

    In order for :math:`C(L)` to be invertible, it must be that each factor
    :math:`(1 - \lambda_i L)` is invertible; the condition is then that
    :math:`|\lambda_i| < 1`, where :math:`\lambda_i` is a root of the
    polynomial.

    The second method factorizes the polynomial into:

    .. math::

        C(L) & = c_0 + c_1 L + \dots + c_n L^n \\
             & = constant (L - \zeta_1) (L - \zeta_2) \dots (L - \zeta_3)

    The condition is now :math:`|\zeta_i| > 1`, where :math:`\zeta_i` is a root
    of the polynomial with reversed coefficients and
    :math:`\lambda_i = \frac{1}{\zeta_i}`.

    Finally, a companion matrix can be formed using the coefficients of the
    polynomial. Then the eigenvalues of that matrix give the roots of the
    polynomial. This last method is the one actually used.

    See Also
    --------
    companion_matrix
     N/A eigvals N/A N/A N/A np linalg eigvals N/A companion_matrix polynomial N/A N/A N/A np all N/A N/A N/A np abs eigvals threshold N/A solve_discrete_lyapunov N/A N/A a q complex_step N/A False N/A N/A 
    Solves the discrete Lyapunov equation using a bilinear transformation.

    Notes
    -----
    This is a modification of the version in Scipy (see
    https://github.com/scipy/scipy/blob/master/scipy/linalg/_solvers.py)
    which allows passing through the complex numbers in the matrix a
    (usually the transition matrix) in order to allow complex step
    differentiation.
     N/A eye N/A N/A np eye N/A N/A a shape N/A 0 N/A N/A complex_step N/A N/A aH N/A N/A N/A N/A a conj transpose N/A aHI_inv N/A N/A N/A np linalg inv N/A aH eye N/A b N/A N/A np dot N/A aH eye aHI_inv N/A c N/A 2 N/A N/A np dot N/A N/A np dot N/A N/A N/A np linalg inv N/A a eye q aHI_inv N/A N/A solve_sylvester N/A N/A N/A N/A b conj transpose b N/A c N/A N/A aH N/A N/A a transpose N/A aHI_inv N/A N/A N/A np linalg inv N/A aH eye N/A b N/A N/A np dot N/A aH eye aHI_inv N/A c N/A 2 N/A N/A np dot N/A N/A np dot N/A N/A N/A np linalg inv N/A a eye q aHI_inv N/A N/A solve_sylvester N/A N/A b transpose b N/A c N/A constrain_stationary_univariate N/A N/A unconstrained N/A N/A N/A 
    Transform unconstrained parameters used by the optimizer to constrained
    parameters used in likelihood evaluation

    Parameters
    ----------
    unconstrained : array
        Unconstrained parameters used by the optimizer, to be transformed to
        stationary coefficients of, e.g., an autoregressive or moving average
        component.

    Returns
    -------
    constrained : array
        Constrained parameters of, e.g., an autoregressive or moving average
        component, to be transformed to arbitrary parameters used by the
        optimizer.

    References
    ----------
    .. [1] Monahan, John F. 1984.
       "A Note on Enforcing Stationarity in
       Autoregressive-moving Average Models."
       Biometrika 71 (2) (August 1): 403-404.
     N/A n N/A N/A unconstrained shape N/A 0 N/A y N/A N/A np zeros N/A n n dtype N/A unconstrained dtype N/A r N/A unconstrained N/A N/A 1 N/A unconstrained 2 0.5 N/A k N/A range n N/A N/A i N/A range k N/A N/A N/A y N/A N/A k i N/A N/A y N/A N/A N/A k 1 i N/A N/A r N/A k N/A y N/A N/A N/A k 1 N/A N/A k i 1 N/A N/A y N/A N/A k k N/A r N/A k N/A N/A N/A y N/A N/A N/A n 1 N/A N/A unconstrain_stationary_univariate N/A N/A constrained N/A N/A N/A 
    Transform constrained parameters used in likelihood evaluation
    to unconstrained parameters used by the optimizer

    Parameters
    ----------
    constrained : array
        Constrained parameters of, e.g., an autoregressive or moving average
        component, to be transformed to arbitrary parameters used by the
        optimizer.

    Returns
    -------
    unconstrained : array
        Unconstrained parameters used by the optimizer, to be transformed to
        stationary coefficients of, e.g., an autoregressive or moving average
        component.

    References
    ----------
    .. [1] Monahan, John F. 1984.
       "A Note on Enforcing Stationarity in
       Autoregressive-moving Average Models."
       Biometrika 71 (2) (August 1): 403-404.
     N/A n N/A N/A constrained shape N/A 0 N/A y N/A N/A np zeros N/A n n dtype N/A constrained dtype N/A N/A y N/A N/A n 1 N/A constrained N/A k N/A range N/A n 1 0 -1 N/A N/A i N/A range k N/A N/A N/A y N/A N/A N/A k 1 i N/A N/A N/A y N/A N/A k i N/A N/A y N/A N/A k k N/A y N/A N/A k N/A N/A k i 1 N/A 1 N/A N/A y N/A N/A k k 2 N/A r N/A N/A y diagonal N/A x N/A r N/A N/A 1 N/A r 2 0.5 N/A x N/A _constrain_sv_less_than_one_python N/A N/A unconstrained order k_endog N/A None None N/A N/A 
    Transform arbitrary matrices to matrices with singular values less than
    one.

    Parameters
    ----------
    unconstrained : list
        Arbitrary matrices. Should be a list of length `order`, where each
        element is an array sized `k_endog` x `k_endog`.
    order : integer, optional
        The order of the autoregression.
    k_endog : integer, optional
        The dimension of the data vector.

    Returns
    -------
    constrained : list
        Partial autocorrelation matrices. Should be a list of length
        `order`, where each element is an array sized `k_endog` x `k_endog`.

    Notes
    -----
    Corresponds to Lemma 2.2 in Ansley and Kohn (1986). See
    `constrain_stationary_multivariate` for more details.

    There is a Cython implementation of this function that can be much faster,
    but which requires SciPy 0.14.0 or greater. See
    `constrain_stationary_multivariate` for details.

     scipy linalg N/A constrained N/A N/A N/A order None N/A N/A order N/A len unconstrained N/A N/A k_endog None N/A N/A k_endog N/A N/A N/A unconstrained N/A 0 shape N/A 0 N/A eye N/A N/A np eye k_endog N/A i N/A range order N/A N/A A N/A unconstrained N/A i N/A N/A B lower N/A N/A linalg cho_factor N/A eye N/A N/A np dot A N/A A T lower True N/A N/A N/A constrained append N/A N/A linalg solve_triangular B A lower lower N/A constrained N/A _compute_coefficients_from_multivariate_pacf_python N/A N/A partial_autocorrelations error_variance transform_variance order k_endog N/A False None None N/A N/A 
    Transform matrices with singular values less than one to matrices
    corresponding to a stationary (or invertible) process.

    Parameters
    ----------
    partial_autocorrelations : list
        Partial autocorrelation matrices. Should be a list of length `order`,
        where each element is an array sized `k_endog` x `k_endog`.
    error_variance : array
        The variance / covariance matrix of the error term. Should be sized
        `k_endog` x `k_endog`. This is used as input in the algorithm even if
        is not transformed by it (when `transform_variance` is False). The
        error term variance is required input when transformation is used
        either to force an autoregressive component to be stationary or to
        force a moving average component to be invertible.
    transform_variance : boolean, optional
        Whether or not to transform the error variance term. This option is
        not typically used, and the default is False.
    order : integer, optional
        The order of the autoregression.
    k_endog : integer, optional
        The dimension of the data vector.

    Returns
    -------
    coefficient_matrices : list
        Transformed coefficient matrices leading to a stationary VAR
        representation.

    Notes
    -----
    Corresponds to Lemma 2.1 in Ansley and Kohn (1986). See
    `constrain_stationary_multivariate` for more details.

    There is a Cython implementation of this function that can be much faster,
    but which requires SciPy 0.14.0 or greater. See
    `constrain_stationary_multivariate` for details.
     scipy linalg N/A N/A order None N/A N/A order N/A len partial_autocorrelations N/A N/A k_endog None N/A N/A k_endog N/A N/A N/A partial_autocorrelations N/A 0 shape N/A 0 N/A N/A transform_variance N/A N/A initial_variance error_variance N/A error_variance N/A N/A N/A np eye k_endog N/A N/A order k_endog 10 N/A forward_variances N/A error_variance N/A backward_variances N/A error_variance N/A autocovariances N/A error_variance N/A forwards N/A N/A backwards N/A N/A error_variance_factor N/A N/A linalg cholesky error_variance lower True N/A forward_factors N/A error_variance_factor N/A backward_factors N/A error_variance_factor N/A s N/A range order N/A N/A prev_forwards forwards N/A prev_backwards backwards N/A forwards N/A N/A backwards N/A N/A N/A N/A forwards append N/A N/A linalg solve_triangular N/A backward_factors N/A s N/A N/A partial_autocorrelations N/A s T lower True trans T N/A N/A forwards N/A 0 N/A N/A np dot N/A forward_factors N/A s N/A N/A forwards N/A 0 T N/A N/A N/A backwards append N/A N/A linalg solve_triangular N/A forward_factors N/A s N/A partial_autocorrelations N/A s lower True trans T N/A N/A backwards N/A 0 N/A N/A np dot N/A backward_factors N/A s N/A N/A backwards N/A 0 T N/A tmp N/A N/A np dot N/A forwards N/A 0 N/A backward_variances N/A s N/A N/A N/A autocovariances append N/A N/A N/A tmp copy T N/A k N/A range s N/A N/A N/A N/A forwards insert k N/A N/A prev_forwards N/A k N/A N/A np dot N/A forwards N/A -1 N/A prev_backwards N/A N/A s N/A k 1 N/A N/A N/A backwards insert k N/A N/A prev_backwards N/A k N/A N/A np dot N/A backwards N/A -1 N/A prev_forwards N/A N/A s N/A k 1 N/A N/A autocovariances N/A N/A s 1 N/A N/A np dot N/A autocovariances N/A N/A k 1 N/A N/A prev_forwards N/A N/A s N/A k 1 T N/A N/A N/A forward_variances append N/A N/A forward_variances N/A s N/A N/A np dot tmp N/A N/A forwards N/A s T N/A N/A N/A backward_variances append N/A N/A backward_variances N/A s N/A N/A np dot N/A N/A np dot N/A backwards N/A s N/A forward_variances N/A s N/A N/A backwards N/A s T N/A N/A N/A forward_factors append N/A N/A linalg cholesky N/A forward_variances N/A N/A s 1 lower True N/A N/A N/A backward_factors append N/A N/A linalg cholesky N/A backward_variances N/A N/A s 1 lower True N/A variance N/A forward_variances N/A -1 N/A N/A transform_variance N/A N/A initial_variance_factor N/A N/A N/A np linalg cholesky initial_variance N/A transformed_variance_factor N/A N/A N/A np linalg cholesky variance N/A transform N/A N/A np dot initial_variance_factor N/A N/A N/A np linalg inv transformed_variance_factor N/A inv_transform N/A N/A N/A np linalg inv transform N/A i N/A range order N/A N/A N/A forwards N/A i N/A N/A np dot N/A N/A np dot transform N/A forwards N/A i inv_transform N/A N/A forwards variance N/A constrain_stationary_multivariate_python N/A N/A unconstrained error_variance transform_variance prefix N/A False None N/A N/A 
    Transform unconstrained parameters used by the optimizer to constrained
    parameters used in likelihood evaluation for a vector autoregression.

    Parameters
    ----------
    unconstrained : array or list
        Arbitrary matrices to be transformed to stationary coefficient matrices
        of the VAR. If a list, should be a list of length `order`, where each
        element is an array sized `k_endog` x `k_endog`. If an array, should be
        the matrices horizontally concatenated and sized
        `k_endog` x `k_endog * order`.
    error_variance : array
        The variance / covariance matrix of the error term. Should be sized
        `k_endog` x `k_endog`. This is used as input in the algorithm even if
        is not transformed by it (when `transform_variance` is False). The
        error term variance is required input when transformation is used
        either to force an autoregressive component to be stationary or to
        force a moving average component to be invertible.
    transform_variance : boolean, optional
        Whether or not to transform the error variance term. This option is
        not typically used, and the default is False.
    prefix : {'s','d','c','z'}, optional
        The appropriate BLAS prefix to use for the passed datatypes. Only
        use if absolutely sure that the prefix is correct or an error will
        result.

    Returns
    -------
    constrained : array or list
        Transformed coefficient matrices leading to a stationary VAR
        representation. Will match the type of the passed `unconstrained`
        variable (so if a list was passed, a list will be returned).

    Notes
    -----
    In the notation of [1]_, the arguments `(variance, unconstrained)` are
    written as :math:`(\Sigma, A_1, \dots, A_p)`, where :math:`p` is the order
    of the vector autoregression, and is here determined by the length of
    the `unconstrained` argument.

    There are two steps in the constraining algorithm.

    First, :math:`(A_1, \dots, A_p)` are transformed into
    :math:`(P_1, \dots, P_p)` via Lemma 2.2 of [1]_.

    Second, :math:`(\Sigma, P_1, \dots, P_p)` are transformed into
    :math:`(\Sigma, \phi_1, \dots, \phi_p)` via Lemmas 2.1 and 2.3 of [1]_.

    If `transform_variance=True`, then only Lemma 2.1 is applied in the second
    step.

    While this function can be used even in the univariate case, it is much
    slower, so in that case `constrain_stationary_univariate` is preferred.

    References
    ----------
    .. [1] Ansley, Craig F., and Robert Kohn. 1986.
       "A Note on Reparameterizing a Vector Autoregressive Moving Average Model
       to Enforce Stationarity."
       Journal of Statistical Computation and Simulation 24 (2): 99-106.
    .. [2] Ansley, Craig F, and Paul Newbold. 1979.
       "Multivariate Partial Autocorrelations."
       In Proceedings of the Business and Economic Statistics Section, 349-53.
       American Statistical Association

     N/A use_list N/A N/A type unconstrained list N/A N/A use_list N/A N/A N/A k_endog order N/A unconstrained shape N/A order k_endog N/A unconstrained N/A N/A unconstrained N/A N/A k_endog N/A N/A i k_endog N/A N/A i 1 k_endog N/A i N/A range order N/A order N/A len unconstrained N/A k_endog N/A N/A N/A unconstrained N/A 0 shape N/A 0 N/A sv_constrained N/A _constrain_sv_less_than_one_python unconstrained order k_endog N/A N/A constrained var N/A _compute_coefficients_from_multivariate_pacf_python sv_constrained error_variance transform_variance order k_endog N/A N/A use_list N/A N/A constrained N/A N/A N/A N/A np concatenate constrained axis 1 reshape k_endog N/A k_endog order N/A N/A constrained var N/A N/A has_trmm N/A constrain_stationary_multivariate N/A N/A unconstrained variance transform_variance prefix N/A False None N/A N/A use_list N/A N/A type unconstrained list N/A use_list N/A N/A unconstrained N/A N/A np concatenate unconstrained axis 1 N/A N/A k_endog order N/A unconstrained shape N/A order k_endog N/A N/A order 1 N/A N/A N/A ValueError Must have order at least 1 N/A N/A k_endog 1 N/A N/A N/A ValueError Must have at least 1 endogenous variable N/A N/A prefix None N/A N/A N/A prefix dtype _ N/A find_best_blas_type N/A unconstrained variance N/A dtype N/A prefix_dtype_map N/A prefix N/A unconstrained N/A N/A np asfortranarray unconstrained dtype dtype N/A variance N/A N/A np asfortranarray variance dtype dtype N/A sv_constrained N/A N/A prefix_sv_map N/A prefix unconstrained order k_endog N/A N/A constrained variance N/A N/A prefix_pacf_map N/A prefix sv_constrained variance transform_variance order k_endog N/A constrained N/A N/A np array constrained dtype dtype N/A variance N/A N/A np array variance dtype dtype N/A use_list N/A N/A constrained N/A N/A constrained N/A N/A k_endog N/A N/A i k_endog N/A N/A i 1 k_endog N/A i N/A range order N/A N/A constrained variance N/A N/A N/A constrain_stationary_multivariate __doc__ N/A constrain_stationary_multivariate_python __doc__ N/A N/A constrain_stationary_multivariate constrain_stationary_multivariate_python _unconstrain_sv_less_than_one N/A N/A constrained order k_endog N/A None None N/A N/A 
    Transform matrices with singular values less than one to arbitrary
    matrices.

    Parameters
    ----------
    constrained : list
        The partial autocorrelation matrices. Should be a list of length
        `order`, where each element is an array sized `k_endog` x `k_endog`.
    order : integer, optional
        The order of the autoregression.
    k_endog : integer, optional
        The dimension of the data vector.

    Returns
    -------
    unconstrained : list
        Unconstrained matrices. A list of length `order`, where each element is
        an array sized `k_endog` x `k_endog`.

    Notes
    -----
    Corresponds to the inverse of Lemma 2.2 in Ansley and Kohn (1986). See
    `unconstrain_stationary_multivariate` for more details.

     scipy linalg N/A unconstrained N/A N/A N/A order None N/A N/A order N/A len constrained N/A N/A k_endog None N/A N/A k_endog N/A N/A N/A constrained N/A 0 shape N/A 0 N/A eye N/A N/A np eye k_endog N/A i N/A range order N/A N/A P N/A constrained N/A i N/A N/A B_inv lower N/A N/A linalg cho_factor N/A eye N/A N/A np dot P N/A P T lower True N/A N/A N/A unconstrained append N/A N/A linalg solve_triangular B_inv P lower lower N/A unconstrained N/A _compute_multivariate_sample_acovf N/A N/A endog maxlag N/A N/A N/A 
    Computer multivariate sample autocovariances

    Parameters
    ----------
    endog : array_like
        Sample data on which to compute sample autocovariances. Shaped
        `nobs` x `k_endog`.

    Returns
    -------
    sample_autocovariances : list
        A list of the first `maxlag` sample autocovariance matrices. Each
        matrix is shaped `k_endog` x `k_endog`.

    Notes
    -----
    This function computes the forward sample autocovariances:

    .. math::

        \hat \Gamma(s) = rac{1}{n} \sum_{t=1}^{n-s}
        (Z_t - ar Z) (Z_{t+s} - ar Z)'

    See page 353 of Wei (1990). This function is primarily implemented for
    checking the partial autocorrelation functions below, and so is quite slow.

    References
    ----------
    .. [1] Wei, William. 1990.
        Time Series Analysis : Univariate and Multivariate Methods.
       Boston: Pearson.
     N/A endog N/A N/A np array endog N/A N/A N/A endog ndim 1 N/A N/A endog N/A endog N/A N/A N/A N/A np newaxis N/A endog N/A N/A np mean endog axis 0 N/A N/A nobs k_endog N/A endog shape N/A sample_autocovariances N/A N/A s N/A range N/A maxlag 1 N/A N/A N/A N/A sample_autocovariances append N/A N/A np zeros N/A k_endog k_endog N/A t N/A range N/A nobs s N/A N/A N/A sample_autocovariances N/A s N/A N/A np outer N/A endog N/A t N/A endog N/A N/A t s N/A N/A sample_autocovariances N/A s nobs N/A sample_autocovariances N/A _compute_multivariate_acovf_from_coefficients N/A N/A coefficients error_variance maxlag forward_autocovariances N/A None False N/A N/A 
    Compute multivariate autocovariances from vector autoregression coefficient
    matrices

    Parameters
    ----------
    coefficients : array or list
        The coefficients matrices. If a list, should be a list of length
        `order`, where each element is an array sized `k_endog` x `k_endog`. If
        an array, should be the coefficient matrices horizontally concatenated
        and sized `k_endog` x `k_endog * order`.
    error_variance : array
        The variance / covariance matrix of the error term. Should be sized
        `k_endog` x `k_endog`.
    maxlag : integer, optional
        The maximum autocovariance to compute. Default is `order`-1. Can be
        zero, in which case it returns the variance.
    forward_autocovariances : boolean, optional
        Whether or not to compute forward autocovariances
        :math:`E(y_t y_{t+j}')`. Default is False, so that backward
        autocovariances :math:`E(y_t y_{t-j}')` are returned.

    Returns
    -------
    autocovariances : list
        A list of the first `maxlag` autocovariance matrices. Each matrix is
        shaped `k_endog` x `k_endog`.

    Notes
    -----
    Computes

    ..math::

        \Gamma(j) = E(y_t y_{t-j}')

    for j = 1, ..., `maxlag`, unless `forward_autocovariances` is specified,
    in which case it computes:

    ..math::

        E(y_t y_{t+j}') = \Gamma(j)'

    Coefficients are assumed to be provided from the VAR model:

    .. math::
        y_t = A_1 y_{t-1} + \dots + A_p y_{t-p} + arepsilon_t

    Autocovariances are calculated by solving the associated discrete Lyapunov
    equation of the state space representation of the VAR process.

     scipy linalg N/A N/A N/A type coefficients list N/A N/A order N/A len coefficients N/A k_endog N/A N/A N/A coefficients N/A 0 shape N/A 0 N/A N/A N/A k_endog order N/A coefficients shape N/A order k_endog N/A coefficients N/A N/A coefficients N/A N/A k_endog N/A N/A i k_endog N/A N/A i 1 k_endog N/A i N/A range order N/A N/A maxlag None N/A N/A maxlag N/A order 1 N/A companion N/A N/A companion_matrix N/A N/A 1 N/A N/A N/A coefficients N/A i N/A i N/A range order T N/A selected_variance N/A N/A np zeros N/A companion shape N/A N/A selected_variance N/A N/A k_endog N/A k_endog error_variance N/A stacked_cov N/A N/A linalg solve_discrete_lyapunov companion selected_variance N/A autocovariances N/A N/A stacked_cov N/A N/A k_endog N/A N/A i k_endog N/A N/A i 1 k_endog N/A i N/A range N/A min order N/A maxlag 1 N/A i N/A range N/A maxlag N/A order 1 N/A N/A stacked_cov N/A N/A np dot companion stacked_cov N/A autocovariances N/A N/A stacked_cov N/A N/A k_endog N/A N/A k_endog N/A forward_autocovariances N/A N/A i N/A range N/A len autocovariances N/A N/A N/A autocovariances N/A i N/A N/A autocovariances N/A i T N/A autocovariances N/A _compute_multivariate_sample_pacf N/A N/A endog maxlag N/A N/A N/A 
    Computer multivariate sample partial autocorrelations

    Parameters
    ----------
    endog : array_like
        Sample data on which to compute sample autocovariances. Shaped
        `nobs` x `k_endog`.
    maxlag : integer
        Maximum lag for which to calculate sample partial autocorrelations.

    Returns
    -------
    sample_pacf : list
        A list of the first `maxlag` sample partial autocorrelation matrices.
        Each matrix is shaped `k_endog` x `k_endog`.

     N/A sample_autocovariances N/A _compute_multivariate_sample_acovf endog maxlag N/A N/A _compute_multivariate_pacf_from_autocovariances sample_autocovariances N/A _compute_multivariate_pacf_from_autocovariances N/A N/A autocovariances order k_endog N/A None None N/A N/A 
    Compute multivariate partial autocorrelations from autocovariances.

    Parameters
    ----------
    autocovariances : list
        Autocorrelations matrices. Should be a list of length `order` + 1,
        where each element is an array sized `k_endog` x `k_endog`.
    order : integer, optional
        The order of the autoregression.
    k_endog : integer, optional
        The dimension of the data vector.

    Returns
    -------
    pacf : list
        List of first `order` multivariate partial autocorrelations.

    Notes
    -----
    Note that this computes multivariate partial autocorrelations.

    Corresponds to the inverse of Lemma 2.1 in Ansley and Kohn (1986). See
    `unconstrain_stationary_multivariate` for more details.

    Notes
    -----
    Computes sample partial autocorrelations if sample autocovariances are
    given.

     scipy linalg N/A N/A order None N/A N/A order N/A N/A len autocovariances 1 N/A N/A k_endog None N/A N/A k_endog N/A N/A N/A autocovariances N/A 0 shape N/A 0 N/A forward_variances N/A N/A backward_variances N/A N/A forwards N/A N/A backwards N/A N/A forward_factors N/A N/A backward_factors N/A N/A partial_autocorrelations N/A N/A s N/A range order N/A N/A prev_forwards N/A list forwards N/A prev_backwards N/A list backwards N/A forwards N/A N/A backwards N/A N/A forward_variance N/A N/A N/A autocovariances N/A 0 copy N/A backward_variance N/A N/A N/A N/A autocovariances N/A 0 T copy N/A k N/A range s N/A N/A forward_variance N/A N/A np dot N/A prev_forwards N/A k N/A autocovariances N/A N/A k 1 N/A backward_variance N/A N/A np dot N/A prev_backwards N/A k N/A N/A autocovariances N/A N/A k 1 T N/A N/A N/A forward_variances append forward_variance N/A N/A N/A backward_variances append backward_variance N/A N/A N/A forward_factors append N/A N/A linalg cholesky N/A forward_variances N/A s lower True N/A N/A N/A backward_factors append N/A N/A linalg cholesky N/A backward_variances N/A s lower True N/A N/A s 0 N/A N/A N/A N/A forwards append N/A N/A N/A linalg cho_solve N/A N/A forward_factors N/A 0 True N/A autocovariances N/A 1 T N/A N/A N/A backwards append N/A N/A N/A linalg cho_solve N/A N/A backward_factors N/A 0 True N/A N/A autocovariances N/A 1 T T N/A N/A tmp_sum N/A N/A N/A N/A autocovariances N/A N/A s 1 T copy N/A k N/A range s N/A N/A tmp_sum N/A N/A np dot N/A prev_forwards N/A k N/A N/A autocovariances N/A N/A s k T N/A N/A N/A forwards append N/A N/A N/A linalg cho_solve N/A N/A backward_factors N/A s True N/A tmp_sum T T N/A N/A N/A backwards append N/A N/A N/A linalg cho_solve N/A N/A forward_factors N/A s True tmp_sum T N/A k N/A range s N/A N/A N/A N/A forwards insert k N/A N/A prev_forwards N/A k N/A N/A np dot N/A forwards N/A -1 N/A prev_backwards N/A N/A s N/A k 1 N/A N/A N/A backwards insert k N/A N/A prev_backwards N/A k N/A N/A np dot N/A backwards N/A -1 N/A prev_forwards N/A N/A s N/A k 1 N/A N/A N/A partial_autocorrelations append N/A N/A linalg solve_triangular N/A forward_factors N/A s N/A N/A np dot N/A forwards N/A s N/A backward_factors N/A s lower True N/A partial_autocorrelations N/A _compute_multivariate_pacf_from_coefficients N/A N/A constrained error_variance order k_endog N/A None None N/A N/A 
    Transform matrices corresponding to a stationary (or invertible) process
    to matrices with singular values less than one.

    Parameters
    ----------
    constrained : array or list
        The coefficients matrices. If a list, should be a list of length
        `order`, where each element is an array sized `k_endog` x `k_endog`. If
        an array, should be the coefficient matrices horizontally concatenated
        and sized `k_endog` x `k_endog * order`.
    error_variance : array
        The variance / covariance matrix of the error term. Should be sized
        `k_endog` x `k_endog`.
    order : integer, optional
        The order of the autoregression.
    k_endog : integer, optional
        The dimension of the data vector.

    Returns
    -------
    pacf : list
        List of first `order` multivariate partial autocorrelations.

    Notes
    -----
    Note that this computes multivariate partial autocorrelations.

    Corresponds to the inverse of Lemma 2.1 in Ansley and Kohn (1986). See
    `unconstrain_stationary_multivariate` for more details.

    Notes
    -----

    Coefficients are assumed to be provided from the VAR model:

    .. math::
        y_t = A_1 y_{t-1} + \dots + A_p y_{t-p} + arepsilon_t
     N/A N/A N/A type constrained list N/A N/A order N/A len constrained N/A k_endog N/A N/A N/A constrained N/A 0 shape N/A 0 N/A N/A N/A k_endog order N/A constrained shape N/A order k_endog N/A _acovf _compute_multivariate_acovf_from_coefficients N/A autocovariances N/A N/A autocovariance T N/A autocovariance N/A _acovf constrained error_variance maxlag order N/A N/A _compute_multivariate_pacf_from_autocovariances autocovariances N/A unconstrain_stationary_multivariate N/A N/A constrained error_variance N/A N/A N/A 
    Transform constrained parameters used in likelihood evaluation
    to unconstrained parameters used by the optimizer

    Parameters
    ----------
    constrained : array or list
        Constrained parameters of, e.g., an autoregressive or moving average
        component, to be transformed to arbitrary parameters used by the
        optimizer. If a list, should be a list of length `order`, where each
        element is an array sized `k_endog` x `k_endog`. If an array, should be
        the coefficient matrices horizontally concatenated and sized
        `k_endog` x `k_endog * order`.
    error_variance : array
        The variance / covariance matrix of the error term. Should be sized
        `k_endog` x `k_endog`. This is used as input in the algorithm even if
        is not transformed by it (when `transform_variance` is False).

    Returns
    -------
    unconstrained : array
        Unconstrained parameters used by the optimizer, to be transformed to
        stationary coefficients of, e.g., an autoregressive or moving average
        component. Will match the type of the passed `constrained`
        variable (so if a list was passed, a list will be returned).

    Notes
    -----
    Uses the list representation internally, even if an array is passed.

    References
    ----------
    .. [1] Ansley, Craig F., and Robert Kohn. 1986.
       "A Note on Reparameterizing a Vector Autoregressive Moving Average Model
       to Enforce Stationarity."
       Journal of Statistical Computation and Simulation 24 (2): 99-106.

     scipy linalg N/A use_list N/A N/A type constrained list N/A N/A use_list N/A N/A N/A k_endog order N/A constrained shape N/A order k_endog N/A constrained N/A N/A constrained N/A N/A k_endog N/A N/A i k_endog N/A N/A i 1 k_endog N/A i N/A range order N/A N/A order N/A len constrained N/A k_endog N/A N/A N/A constrained N/A 0 shape N/A 0 N/A partial_autocorrelations N/A _compute_multivariate_pacf_from_coefficients constrained error_variance order k_endog N/A unconstrained N/A _unconstrain_sv_less_than_one partial_autocorrelations order k_endog N/A N/A use_list N/A N/A unconstrained N/A N/A np concatenate unconstrained axis 1 N/A N/A unconstrained error_variance N/A validate_matrix_shape N/A N/A name shape nrows ncols nobs N/A N/A N/A 
    Validate the shape of a possibly time-varying matrix, or raise an exception

    Parameters
    ----------
    name : str
        The name of the matrix being validated (used in exception messages)
    shape : array_like
        The shape of the matrix to be validated. May be of size 2 or (if
        the matrix is time-varying) 3.
    nrows : int
        The expected number of rows.
    ncols : int
        The expected number of columns.
    nobs : int
        The number of observations (used to validate the last dimension of a
        time-varying matrix)

    Raises
    ------
    ValueError
        If the matrix is not of the desired shape.
     N/A ndim N/A len shape N/A N/A ndim N/A 2 3 N/A N/A N/A ValueError N/A Invalid value for %s matrix. Requires a 2- or 3-dimensional array, got %d dimensions N/A name ndim N/A N/A N/A N/A shape N/A 0 nrows N/A N/A N/A ValueError N/A Invalid dimensions for %s matrix: requires %d rows, got %d N/A name nrows N/A shape N/A 0 N/A N/A N/A N/A shape N/A 1 ncols N/A N/A N/A ValueError N/A Invalid dimensions for %s matrix: requires %d columns, got %d N/A name ncols N/A shape N/A 1 N/A N/A N/A nobs None N/A N/A N/A ndim 2 N/A N/A shape N/A -1 1 N/A N/A N/A ValueError N/A Invalid dimensions for %s matrix: time-varying matrices cannot be given unless `nobs` is specified (implicitly when a dataset is bound or else set explicity) name N/A N/A N/A ndim 3 N/A nobs None N/A N/A N/A shape N/A -1 N/A 1 nobs N/A N/A N/A ValueError N/A Invalid dimensions for time-varying %s matrix. Requires shape (*,*,%d), got %s N/A name nobs N/A str shape N/A validate_vector_shape N/A N/A name shape nrows nobs N/A N/A N/A 
    Validate the shape of a possibly time-varying vector, or raise an exception

    Parameters
    ----------
    name : str
        The name of the vector being validated (used in exception messages)
    shape : array_like
        The shape of the vector to be validated. May be of size 1 or (if
        the vector is time-varying) 2.
    nrows : int
        The expected number of rows (elements of the vector).
    nobs : int
        The number of observations (used to validate the last dimension of a
        time-varying vector)

    Raises
    ------
    ValueError
        If the vector is not of the desired shape.
     N/A ndim N/A len shape N/A N/A ndim N/A 1 2 N/A N/A N/A ValueError N/A Invalid value for %s vector. Requires a 1- or 2-dimensional array, got %d dimensions N/A name ndim N/A N/A N/A N/A shape N/A 0 nrows N/A N/A N/A ValueError N/A Invalid dimensions for %s vector: requires %d rows, got %d N/A name nrows N/A shape N/A 0 N/A N/A N/A nobs None N/A N/A N/A ndim 1 N/A N/A shape N/A -1 1 N/A N/A N/A ValueError N/A Invalid dimensions for %s vector: time-varying vectors cannot be given unless `nobs` is specified (implicitly when a dataset is bound or else set explicity) name N/A N/A N/A ndim 2 N/A N/A N/A shape N/A 1 N/A 1 nobs N/A N/A N/A ValueError N/A Invalid dimensions for time-varying %s vector. Requires shape (*,%d), got %s N/A name nobs N/A str shape N/A