tag:blogger.com,1999:blog-8091991448412546705.post4532373701291967100..comments2024-02-17T04:20:49.446-05:00Comments on Minding the Brain: Multiple pairwise comparisons for categorical predictorsDan Mirmanhttp://www.blogger.com/profile/09484166723075799719noreply@blogger.comBlogger9125tag:blogger.com,1999:blog-8091991448412546705.post-39331604971701680442016-08-30T10:38:57.707-04:002016-08-30T10:38:57.707-04:00glht returns parameter estimates for the compariso...glht returns parameter estimates for the comparisons along with SE for those estimates. You can use the SE to compute confidence intervals if you want. I also like the effects package for computing estimates and CI.Dan Mirmanhttps://www.blogger.com/profile/09484166723075799719noreply@blogger.comtag:blogger.com,1999:blog-8091991448412546705.post-37287010290402869262016-08-30T10:32:16.646-04:002016-08-30T10:32:16.646-04:00Hi Libby,
Sorry it took me a long time to get to t...Hi Libby,<br />Sorry it took me a long time to get to this, and I'm not sure my answer will be relevant any more, but here goes. The logic is the same, you just have to extend the structure of the contrast matrix to the quadratic Time^2 terms. Dan Mirmanhttps://www.blogger.com/profile/09484166723075799719noreply@blogger.comtag:blogger.com,1999:blog-8091991448412546705.post-90556934682922606552016-08-29T22:43:36.847-04:002016-08-29T22:43:36.847-04:00Hi Dan,
Thanks for the tutorial.. Super helpful. I...Hi Dan,<br />Thanks for the tutorial.. Super helpful. I wonder if we could get confidence intervals for the comparisons too using glht. Thanks!<br /><br /> :)Sakshi Aryahttps://www.blogger.com/profile/03540088621140880120noreply@blogger.comtag:blogger.com,1999:blog-8091991448412546705.post-78020492588410591062016-04-26T18:54:39.358-04:002016-04-26T18:54:39.358-04:00Hi Dan,
Thanks for this tutorial - super helpful!...Hi Dan, <br />Thanks for this tutorial - super helpful! I had one follow-up question, do you know how this might change if there was a quadratic for time? The particular model I am fitting has linear and a quadratic terms for age (and then cohort as a a categorical predictor with 4 levels), so I wonder how this affects the contrast coding? <br />Thanks in advance for any help you may have to offer! =:-]Libby Bensonhttps://www.blogger.com/profile/16344500068023929750noreply@blogger.comtag:blogger.com,1999:blog-8091991448412546705.post-83792846078972342432016-04-18T21:49:45.880-04:002016-04-18T21:49:45.880-04:00Thank you Dan for this amazing posting. It really ...Thank you Dan for this amazing posting. It really helped me to understand how to make a contrast matrix. But, I am still wondering how to do that when there are more than two factors. For example, in this ChickWeight dataset, we may add one more column for gender (F for female and M for male). Then we will have 8 lines instead of 4 (F1 to F4, M1 to M4). In this case, do you happen to know to make a contrast matrix? I think I can make contrasts within one gender like <br />time:F1 vs. time:F2<br />time:F1 vs. time:F3<br />time:F1 vs. time:F4 <br />time:F2 vs. time:F3<br />time:F2 vs. time:F4<br />time F3 vs. time:F4<br /><br />But, if I want to compare the slopes across genders and diets like<br />time:F1 vs. time:M1<br />time:F1 vs. time:M2<br />.....<br /><br />I have little idea on making contrasts. If you know some tips about this, I will really appreciate it!<br /><br />Thank you,<br />KJ Anonymoushttps://www.blogger.com/profile/01434510555863063754noreply@blogger.comtag:blogger.com,1999:blog-8091991448412546705.post-89286436498581192272015-12-16T13:42:03.154-05:002015-12-16T13:42:03.154-05:00Hi Noah,
I'm not quite sure what you're af...Hi Noah,<br />I'm not quite sure what you're after with the "contrast of contrasts". When you compare "T:D2 vs. T:D4" against "T:D3 vs. T:D4", T:D4 is in both and it cancels out, so you end up with a "T:D2 vs. T:D3" comparison. Your contrast matrix arithmetic was internally consistent, so it produced that exact vector, which was already in the matrix (except with opposite signs, but it's the same contrast). Hope that helps.Dan Mirmanhttps://www.blogger.com/profile/09484166723075799719noreply@blogger.comtag:blogger.com,1999:blog-8091991448412546705.post-26892735983181508242015-12-15T10:51:59.287-05:002015-12-15T10:51:59.287-05:00Hi Dan, thanks for this helpful post. I'm tryi...Hi Dan, thanks for this helpful post. I'm trying to apply it to some of my own work, and I'm curious: if you wanted to do a 'contrast of contrasts,' would you just subtract one row in the contrast matrix from another?<br /><br />For example, say you wanted to know the difference between 'Time:Diet3 vs. Time:Diet4' and 'Time:Diet3 vs. Time:Diet4'. Would you subtract (0, 0, 0, 0, 0, 0, -1, 1) from (0, 0, 0, 0, 0, -1, 0, 1) and therefore get (0,0,0,0,1,-1,0)? You would then run the contrast c(0,0,0,1,-1,0) with the same model above ('m') to get this contrast of contrasts? <br /><br />This is the approach I have been using, just wanted to confirm with someone else who had experience using this approach. <br /><br />Thanks, <br />Noah Sokol (noah.sokol@yale.edu)Anonymoushttps://www.blogger.com/profile/11758399686392887194noreply@blogger.comtag:blogger.com,1999:blog-8091991448412546705.post-52404930821030051702015-04-18T20:45:39.032-04:002015-04-18T20:45:39.032-04:00In general, I prefer to treat continuous predictor...In general, I prefer to treat continuous predictors (like Time) as continuous and to evaluate effects of conditions (like Diet) on patterns/trajectories over those continuous predictors (intercepts, slopes, curvature parameters, etc.). Most of the phenomena I deal with evolve gradually over time, so my default is to be suspicious of claims that X occurred at time T; especially if it that claim is based on a p-value being less than <0.05 at T but not T-1. If the time points are discrete events (for example, pre-test, post-test, and follow-up), then it can make sense to treat Time as a factor and apply the contrast matrix logic to get pairwise comparisons at different (discrete) time points -- exactly as you suggest.Dan Mirmanhttps://www.blogger.com/profile/09484166723075799719noreply@blogger.comtag:blogger.com,1999:blog-8091991448412546705.post-36751187645937169572015-04-18T10:58:57.600-04:002015-04-18T10:58:57.600-04:00Thank you for an interesting and informative post,...Thank you for an interesting and informative post, Dan! If we wanted to test differences in specific diets at each time point, how would we set up our contrasts? In particular, would we need to specify Time as a factor (i.e., categorical variable) so that we can control which levels of time we are looking at when comparing diets? Isabella R. Ghement, Ph.D.https://www.blogger.com/profile/12764806870780813453noreply@blogger.com