Skip to main content
9 events
when toggle format what by license comment
Mar 14, 2022 at 21:56 history edited dipetkov CC BY-SA 4.0
added 96 characters in body
Mar 14, 2022 at 21:21 history edited dipetkov CC BY-SA 4.0
added 616 characters in body
Mar 14, 2022 at 20:51 history edited dipetkov CC BY-SA 4.0
added 56 characters in body
Mar 13, 2022 at 11:09 comment added dipetkov You probably also want the standard error of the contrast, which might not be trivial with a non-standard model. It might be best to ask another question with more details about your model.
Mar 13, 2022 at 11:01 comment added dipetkov A contrast is a linear combination of the factor levels. And yes, you can choose any contrast to define the model matrix and fit the model. But you are interested in two different contrasts. Why fit the model twice to make these two comparisons? Instead fit the model once and then look at any number of comparisons.
Mar 13, 2022 at 10:56 comment added jO. Thanks! I thought it was possible to define any comparison in the design matrix which would be carried through to the model matrix and to the model fit. Not only something you do once you have fitted the model post-hoc. In my case, I work on posterior distributions from a non-standard r format so I need to solve it manually. I’ll read up on the contrast package!
Mar 13, 2022 at 9:37 comment added dipetkov By "do a contrast", do you mean to define it (ie. come up with the design matrix which corresponds to the comparison)? Or to compute it (ie. multiply the design matrix by the matrix of estimated coefficients)? I would avoid computing contrasts by hand as it's easy to get the linear algebra wrong. Look at the documentation for ?rms::contrast and at the contrast package. One or the other of these resources probably gets you what you need.
Mar 13, 2022 at 9:18 comment added jO. Thank you so much for your reply. Would you know how to manually do the same contrast from a fitted model?
Mar 13, 2022 at 3:16 history answered dipetkov CC BY-SA 4.0