Skip to main content

Timeline for What is a contrast matrix?

Current License: CC BY-SA 4.0

26 events
when toggle format what by license comment
Sep 15 at 16:06 comment added Tomas But perhaps modify the reference for "ANOVA regression" - I didn't ask for ANOVA specifically! (Also not sure if "ANOVA regression" is a thing, should be either ANOVA or regression as I heard it)
Sep 15 at 15:59 vote accept Tomas
Sep 15 at 15:59 comment added Tomas Finally someone who actually answered the question. Thank you very much!
Nov 19, 2022 at 6:41 history edited User1865345 CC BY-SA 4.0
added 86 characters in body
Jul 9, 2016 at 12:12 comment added ttnphns (cont.) Of course the L matrix in both "approaches " is the same (and no mysterious G matrix is needed). Show that two equivalent paths (L is arbitrary, X is dummies): L -> XC -> regression -> result and X -> [regression -> adjusting to test for L] -> result leave the same result. The 2nd path is how an ANOVA program will do (the bracketed part []); the 1st path is a didactic demonstration how contrasts are solvable via only regression program.
Jul 9, 2016 at 12:04 comment added ttnphns I'm happy that we kinda speak the same language now. It seems so, at least. It would be great for everybody, especially a visitor reader, if you accomplish your answer, showing how Gus' and ttnphns' reports convert to the same result. If you want to accomplish.
Jul 9, 2016 at 8:58 comment added amoeba (cont.) So I am not sure what exactly you would like me to show (if anything). Just to be clear: that's what I meant in my point (2) in this yesterday's comment. I thought back then you were saying it's impossible to do.
Jul 9, 2016 at 8:58 comment added amoeba It looks like we are almost on the same page by now, @ttnphns. What I was going to show in my answer is to take dummy X (from your example) in Matlab, compute the betas via the usual regression formula, and then use the formula from Gus'es answer to compute the p-values for your L matrix (without changing C-matrix or X matrix). Does it qualify as "an arbitrary L is possible to test with just dummy X in a regression program"? Before I thought so, but reading your comments now, it looks like you will say that it's just a "bypassing" trick. And I agree, deep down it's probably equivalent.
Jul 9, 2016 at 1:16 comment added ttnphns In short, my answer was to show the equivalence between ANOVA and regression and the meaning of ANOVA contrasts as regressional parameters. While I see @Gus_est answer as algebraic sketch or delineation of computations actually done in (GLM-based) ANOVA programs. So far I see no contradiction between the two accounts.
Jul 9, 2016 at 0:41 comment added ttnphns (cont.) And my answer aimed to show the meaning of contrast coefficients via that regression coefficients. So: in order to show that I'm mistaken (which is possible!) in saying that L and C (and hence X) are related, you must show that an arbitrary L is possible to test with just dummy X in a regression program (i.e. program which accepts only "continuous" predictors).
Jul 9, 2016 at 0:31 comment added ttnphns (cont.) But if you have to do that contrast testing via a vanilla regression program you'll have to do the recoding explicitly - into specific codes defined by C=ginv(L). At least I claim so. My answer was about that regression trick, as I said there, and not about a GLM program algo.
Jul 9, 2016 at 0:31 comment added ttnphns (cont.) You say - later they choose some arbitrary L to test. Yes. You say they don't convert the X into other codes (which you say I demand to do, to be able to test the contrasts). I say: sure, the program doesn't need to do that because it uses special formulas designed to bypass explicit re-coding of X, the "recoding" takes place as if implicitly/covertly. SPSS algorithms doc as well as Rencher & Schaalje, "Linear Models in Statistics" (Gus' source) give those formulae - they are the basis of ANOVA programs designed as GLM algo.
Jul 9, 2016 at 0:30 comment added ttnphns Amoeba, upon reading that two last paragraphs of "AN OVERVIEW OF MANOVA" section, I can't see how it contradicts to my answer. You say they show the dummy coded X: I say yes, most GLM programs (in SPSS, SAS - sure) parameterize initially based on indicator coded X (it is computationally efficient and has other conveniences).
Jul 8, 2016 at 23:37 comment added amoeba @ttnphns, Thanks for this last link. I took a very brief look now, and doesn't this manual actually follow exactly the logic that we have been disagreeing about? Look, on page 2 they present the design matrix $X$, and it is dummy coded. I.e. the C-matrix is fixed already there once and for all. Later an L-matrix is introduced that specifies the null hypothesis (together with the M, apparently), and then one can somehow perform the significance test. It does not look like this L-matrix is being converted into C, etc. That's precisely the framework I've describing (following Gus)...
Jul 8, 2016 at 21:42 comment added ttnphns For a reader. This doc: Planned Contrasts and Post Hoc Tests in MANOVA Made Easy is SAS oriented and it shares the same definition and notation (L, M matrices in the general MANOVA testing formula LBM=0) as SPSS does.
Jul 8, 2016 at 20:59 comment added ttnphns (A note for a reader to my second comment above) in the linked document, despite it is titled "coding schemes", the matrices displayed/explained there are contrast coefficient L-matrices, corresponding to the coding schemes, and not the coding C-matrices themselves (which are their inverses).
Jul 8, 2016 at 20:07 history edited amoeba CC BY-SA 3.0
added 11 characters in body
Jul 8, 2016 at 19:39 history edited amoeba CC BY-SA 3.0
added 169 characters in body
Jul 8, 2016 at 19:38 comment added amoeba I fully trust you that "contrast coefficient matrix" is a standard term in SPSS literature, but it seems not to be used in textbooks unrelated to SPSS. I think this term originates in the SPSS literature (which is fine with me). I specified it in my edit.
Jul 8, 2016 at 19:37 comment added amoeba @ttnphns, to your protest: I continue to maintain that one can test any null hypothesis (any contrast), independent of the coding scheme. I already checked that it works with your example data, I will write it up later. For now I invite you to believe me :-) Hence, in my mind, there is C-matrix, L-matrix, but one can also have G-matrix if one wants. C-matrix is called "contrast matrix" in the R literature. G-matrix is called "contrast matrix" by Gus and also in the Mohanan's book referenced by him. That's why I say that "contrast matrix" has two meanings. I edited to refine wording.
Jul 8, 2016 at 19:33 history edited amoeba CC BY-SA 3.0
added 169 characters in body
Jul 8, 2016 at 18:10 comment added ttnphns Contrasts constituting a contrast coefficients matrix sum up to the treatment effect of the factor. If the factor (or other effect, an interaction) has k levels, its effect (SS, df, p-value) is equal to the combined effect of k-1 contrasts forming the L matrix. An ANOVA program, may allow to specify any subset of the k-1 contrasts if you don't need to test every of them (therefore no need for word "matrix" may arise in docs for the program). But if you want to do it by linear regression program you have to input all the contrasts (form the matrix) to pack them together in the factor.
Jul 8, 2016 at 17:11 comment added ttnphns You were asking about meaning #2 We actually are not sure what meaning of the term the OP implied. The OP displayed some examples of contrast coding schemes, - it doesn't necessarily mean s/he wasn't interested in L matrices.
Jul 8, 2016 at 16:59 comment added ttnphns (cont.) Contrast coefficent L matrix is a standard term in ANOVA / General linear model, used in texts and in SPSS docs, for example. The coding schemes see here.
Jul 8, 2016 at 16:58 comment added ttnphns The answer by @Gus_est explores the first meaning. The answer by @ttnphns explores the second meaning. I protest. (And am surprised to hear - after we both had a long conversation on the definitions in the comments to mty answer.) I invited two terms: contrast coefficient matrix (where rows are the contrasts, linear combibnation of means) aka L-matrix, and contrast coding schema matrix, aka C matrix. Both are related, I discussed both.
Jul 8, 2016 at 16:19 history answered amoeba CC BY-SA 3.0