Open josef-pkt opened 10 years ago
Two background docs (that I never worked my way through) http://statsmodels.sourceforge.net/devel/contrasts.html http://patsy.readthedocs.org/en/latest/categorical-coding.html
same or similar to Kerby's reparameterization,
Stata has function makecns
— Constrained estimation with technical details in the (P) manual
Note: Stata calculates the LS estimate in the transformed model, but reports the results in the original parameterization.
implication: cov_params has reduced rank (rank(exog) - k_constraints)
see #1131 for numerical reasons why we might want to temporarily internally transform for estimation.
Similar: Ridge Regression works with standardized and orthogonalized variables internally, in the description in articles. Also PCR can report results in the original parameterization, instead of in factor space.
additionally on imposing linear restrictions R params = q
through transformation
In Stata, if q != 0
this is an affine, and not a linear transformation params = T dot params_reduced + a
where T
is the linear transformation matrix and a
is a constant.
Which means we cannot just run OLS with the reparameterized exog.
this issue is a bit outdated
see #4361 for the contrast/restriction part and links to other issues
imposing linear or affine restrictions has been implemented in fit_constrained
for model with an offset (GLM and count models)
one item where I don't know where it should go:
base._constraints has transform_params_constraint
(I found it now because it has zero unit test coverage.)
to go from unconstrained to constrained estimate.
This was intended somewhere for one-step methods or as starting parameter for restricted estimation, e.g. likelihood ratio test for imposing restrictions, dropping variables.
bump for transform_params_constraint
I did not remember whether or where I had parked this. Also, a reference would be helpful, I don't remember where I saw this, most likely it's in several text books.
It would be useful to have also the corresponding cov_params for the constrained params
There is a version for multivariate linear model. #8722 e.g. for MANOVA type multivariate constraints L B M = C Berndt, Ernst R., and N. Eugene Savin. “Conflict among Criteria for Testing Hypotheses in the Multivariate Linear Regression Model.” Econometrica 45, no. 5 (1977): 1263–77. https://doi.org/10.2307/1914072.
Kubáček, Lubomír. “Multivariate Regression Model with Constraints.” Mathematica Slovaca 57, no. 3 (June 1, 2007): 271–96. https://doi.org/10.2478/s12175-007-0022-7.
so far they are mainly in t_test and f_test plus the restricted estimation in GEE.
extra: naming convention
r_matrix, q_matrix is not really good (although I always remember it), used also in TheilGLS RLS #1667 uses
constr
andparam