# [R-sig-ME] Set two coefficients to be equal in lme()

Uanhoro, James u@nhoro@1 @end|ng |rom buckeyem@||@o@u@edu
Sat Jan 16 15:00:22 CET 2021

```If D1 and D2 are coded {-.5, .5} as you suggested in a separate email, then D1+D2 = 0 if all cases either belong to group D1 or D2 and never both. Then read Treat * new_var = 0, a constant not a variable.

In that case, simply use Treat in the model by itself - again, this is the same as constraining both groups to have the same Treat coefficient.

lme(value ~ 0 + D1 + D2 + Treat, random = ~0 + D1 + D2 | Student, data = data)

Also, basic idea behind all this is: b * x1 + b * x2 = b * (x1 + x2).

James.

________________________________
From: R-sig-mixed-models <r-sig-mixed-models-bounces using r-project.org> on behalf of Uanhoro, James <uanhoro.1 using buckeyemail.osu.edu>
Sent: Saturday, January 16, 2021, 01:10
To: r-sig-mixed-models using r-project.org
Subject: Re: [R-sig-ME] Set two coefficients to be equal in lme()

Dear Simon,

Create a variable that is the sum of D1 * Treat and D2 * Treat and place it in the model:

data\$new_var <- (data\$D1 + data\$D2) * data\$Treat
lme(value ~ 0 + D1 + D2 + new_var, random = ~0 + D1 + D2 | Student, data = data)

The coefficient of new_var in the model above is the coefficient for both variables if their coefficients were constrained equal.

James.

On Fri, 2021-01-15 at 23:42 -0600, Simon Harmel wrote:
Dear All,

I was wondering if it might be possible in my below model to set
"D1:Treat" and "D2:Treat" to be equal?

lme(value ~ 0 + D1 + D2 + D1:Treat + D2:Treat, random = ~0 + D1 + D2 |
Student, data = data)

Thank you,
Simon

[[alternative HTML version deleted]]

_______________________________________________
R-sig-mixed-models using r-project.org<mailto:R-sig-mixed-models using r-project.org> mailing list

[[alternative HTML version deleted]]

_______________________________________________
R-sig-mixed-models using r-project.org mailing list
https://urldefense.com/v3/__https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models__;!!KGKeukY!nTI9flHdl-yk8eCV0yW6MKuX9CpUt1ou2zObcnZPtbJwnD2foUvMOxLrBWzjyQRnZaJ8y6i-FWw\$

[[alternative HTML version deleted]]

```