[R] simple interactions

Martin Maechler maechler at stat.math.ethz.ch
Fri Apr 15 16:13:50 CEST 2016

>>>>> Therneau, Terry M , Ph D <therneau at mayo.edu>
>>>>>     on Fri, 15 Apr 2016 06:58:22 -0500 writes:

    > I'd like to get interaction terms in a model to be in
    > another form.  Namely, suppose I had variables age and
    > group, the latter a factor with levels A, B, C, with age *
    > group in the model.  What I would like are the variables
    > "age:group=A", "age:group=B" and "age:group=C" (and group
    > itself of course).  The coefficients of the model will
    > then be the age effect in group A, the age effect in group
    > B and the age effect in C rather than the standard ones of
    > an overall age effect followed by contrasts.  These is
    > often a better format for tables in a publication.

Did you try  to use  one of the good old




Please use R  3.2.4 or newer, notably for dummy.coef() which was
improved (made more generally working) for R 3.2.4, notably
thanks to my colleague Werner Stahel.

Best regards,

Martin Maechler, ETH Zurich


    > Yes, I can reconstruct these from the original fit, but I
    > have a lot of variables for several models and it would be
    > easier to have an automatic form.  I suspect that there is
    > an easy answer, but I don't see it.

    > Terry Therneau

    > ______________________________________________
    > R-help at r-project.org mailing list -- To UNSUBSCRIBE and
    > more, see https://stat.ethz.ch/mailman/listinfo/r-help
    > PLEASE do read the posting guide
    > http://www.R-project.org/posting-guide.html and provide
    > commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list