Open josef-pkt opened 8 years ago
just an idea, vague memory: MANOVA has constraints matrices before and after params, L, C: 2 constraints matrices B: 2-d parameter vector
linear combination = L dot B dot C (or something like that)
question: can we use L and C to constrain a single element of B? i.e. L selects rows, C selects the column, and L B C is just one element.
but I guess this doesn't vectorize, i.e. select random elements instead of submatrices
>>> import numpy as np
>>> b = np.arange(20).reshape(5,4)
>>> L = np.array([[0, 1, 0, 0, 0]])
>>> C = np.array([[0, 0, 1, 0]]).T
>>> L.dot(b.dot(C))
array([[6]])
>>> b
array([[ 0, 1, 2, 3],
[ 4, 5, 6, 7],
[ 8, 9, 10, 11],
[12, 13, 14, 15],
[16, 17, 18, 19]])
(context: single parameter constraints in VAR or Bayesian VAR)
related: #3291 adds mv_test
for MANOVA and multivariate regression
We can get the constraint for raveled/stacked parameters using a kronecker product
like np.kron(L, C)
however this needs to be carefully checked for the right transpose and ravel("F")
np.kron(L, C.T).dot(params.ravel("F"))
?
This article has some examples for multivariate tests with stacked parameters. (main point of article is small sample critical values under normality assumption which is not directly relevant here.) Randall, Robert L., J. Arthur Woodward, and Douglas G. Bonett. 1997. “A Wald Test for the Multivariate Analysis of Variance:small Sample Critical Values.” Communications in Statistics - Simulation and Computation 26 (4): 1275–99. doi:10.1080/03610919708813440.
How to we handle t_test and wald_test generically for models that have "naturally" 2-dimensional params?
examples: currently VAR, Multinomial, more are coming VECM, SUR, ...
one option would be to ravel/
vec
the params and store them in standard 1-D form.another option that I'm thinking about in this issue is to support wald tests or general linear restriction tests for 2-D params and associated raveled or structural cov_params.
needed for current t_test and wald_test
extras for special cases: sparse or structured cov_params, e.g. kronecker product