## estimate continuous - categorical interaction

Solved
Occasional Contributor
Posts: 16

# estimate continuous - categorical interaction

Hello,

Probably a very simple question for the slightly experienced statisticians.

I want to use the estimate statement to calculate the parameter estimate of an interaction of a continuous variable with a categorical variable in PROC MIXED. I understand that one of the betas in the 'solutions for fixed effects' is set at 0 or the reference (at least I thought I understood).

Lets say I have:

proc mixed data=test.components;

class treatment homogeneous;

model bwcomp=treatment  homogeneous husacomp treatment*husacomp;

estimate  'test'  husacomp 1 treatment*husacomp 1 0

run;

The solution for fixed effects states for the estimates:

 intercept 1.0609 Treatment A -0.8602 Treatment B 0 Homogeneous mix 0.1577 Homogeneous uni 0 husacomp 0.7271 Husacomp*treatment A -0.9016 Husacomp*treatment B 0

The estimate statement for Husacomp*treatment A will give the estimate -0.1745, which is 0.7271-0.9016. If I run the estimate statement for B it will give 0.7271.

If I run the following model:

proc mixed data = test.components;

class treatment homogeneous;

model bwcomp = treatment  homogeneous husacomp treatment*husacomp homogeneous*husacomp;

estimate  'test'  husacomp 1 treatment*husacomp 1 0

run;

I get:

 intercept 1.0102 Treatment A -0.7845 Treatment B 0 Homogeneous mix 0.1762 Homogeneous uni 0 husacomp 0.5788 Husacomp*treatment A -0.8719 Husacomp*treatment B 0 Husacomp*homogeneous mix 0.3269 Husacomp*homogeneous uni 0

And the estimate statement returns -0.1297 for for Husacomp*treatment A. I don't seem to understand how this number is achieved. I'm probably doing something stupid and am missing out on something. I'm not too versed with the estimate statement and if anyone could help me, it would be appreciated.

Accepted Solutions
Solution
‎10-30-2015 11:34 AM
Posts: 2,655

## Re: estimate continuous - categorical interaction

OK, I think I see what the problem might be.  Correct me if I am wrong in this assumption, but I believe husacomp is a continuous variable and you want to know how to include a unit change in husacomp in the estimate.  In the second model, I am certain that something is going on with homogeneous*husacomp.  The best diagnostic I can offer right off the top of my head is to add the E option to your ESTIMATE statement--I think there is a term in the L matrix that is not captured with just the coefficients you entered (no guarantee on this, though).  Try it and see if that is at all possible.

A quick calculation shows that the result is .5788 + (-0.8719) + 0.5 * (0.3269), so it looks like the L matrix is averaging over the coefficients for homogeneous*husacomp, in order to "remove" any effects there.

Steve Denham

All Replies
Solution
‎10-30-2015 11:34 AM
Posts: 2,655

## Re: estimate continuous - categorical interaction

OK, I think I see what the problem might be.  Correct me if I am wrong in this assumption, but I believe husacomp is a continuous variable and you want to know how to include a unit change in husacomp in the estimate.  In the second model, I am certain that something is going on with homogeneous*husacomp.  The best diagnostic I can offer right off the top of my head is to add the E option to your ESTIMATE statement--I think there is a term in the L matrix that is not captured with just the coefficients you entered (no guarantee on this, though).  Try it and see if that is at all possible.

A quick calculation shows that the result is .5788 + (-0.8719) + 0.5 * (0.3269), so it looks like the L matrix is averaging over the coefficients for homogeneous*husacomp, in order to "remove" any effects there.

Steve Denham

Valued Guide
Posts: 684

## Re: estimate continuous - categorical interaction

There have been several posts, with answers, on the coding and meaning of interactions of factors and continuous variables.

Occasional Contributor
Posts: 16

## Re: estimate continuous - categorical interaction

[ Edited ]

Thank you SteveDenham for the  useful and very helpful answer (indeed husacomp is a continuous variable). I see how to manually calculate it now. When the e option is entered for the second model I get:

 Effect treatment homogeneous Row1 Intercept treatment HuSA treatment PBS homogeneous mix homogeneous uniform husacomp 1 husacomp*treatment HuSA 1 husacomp*treatment PBS husacomp*homogeneous mix 0.5 husacomp*homogeneous uniform 0.5

Which would mean (as I understand it) that with the estimate statement from the second model I am purely looking at what the effect is of a 1 unit increase in husacomp in the HuSA group (the class variable) on BWcomp (which is what I was interested in, to specifically indicate what the effect was of that interaction).

(I know that there are other posts handling interactions, but I did not seem to get (or likely, understand) the answer from those posts.)

🔒 This topic is solved and locked.