BookmarkSubscribeRSS Feed
Eran
Calcite | Level 5

Hi all,

I'm trying to figure out how to constrain one/few fix effect in proc mixed?

Do anybody know how/if I can do that?

Thanks

Eran

6 REPLIES 6
lvm
Rhodochrosite | Level 12 lvm
Rhodochrosite | Level 12

You question is vague, but I assume you want to restrict a parameter to be positive (or negative), or you want more complex restrictions involving multiple parameters. Unfortunately, there is no explicit way of restricting the parameters (nothing like the RESTRICT statement in REG). There are some advanced techniques where one can obtain restrictions by reformulating the model in terms of other created variables. But I don't know of any easy-to-use code for this. If you were more specific in your question, with an example, I could tell you more.

Eran
Calcite | Level 5

I will try to be more specific

Let's say that I have a diary data from several subjects. That is my data has a structure of  days nested within persons.

Let's say that my hypothesis is that daily mood will be predicted by daily positive and negative events.

So I want to use multi-level models analyses (MLM/HLM) with proc mixed to test my hypotheses.  

My model would be something like this

level 1: MOODjt= b0j + b1j*positive event + b2j*negative event + eij

(j=person j, t=day t)

And the level 2 (random) of the model would be-

Level 2: 

b0j= γ00+ uoj

b1j= γ10+ u1j

b2j= γ20+ u2j

To test this model I would use the following proc mixed syntax

     

proc mixed covtest data=X;

class id day;

model mood= positive_event negative_event/s ;

random intercept positive_event negative_event/subject = id;

repeated day/subject = id type = ar(1);

run;

my question is if I want to constrain the positive_event and Negative_event to have the same weights (let's say of 1) in order to test if they are different from each other (that is, if the constrained model has less fit than the unconstrained model), how can I do that?

Put it more simply, if I want that a certain fix effect will have specific value in order to test how it influences the fit of the model, how can I do it?

Thanks a lot

Eran

lvm
Rhodochrosite | Level 12 lvm
Rhodochrosite | Level 12

Here is an outline of one possible approach. I am assuming by 'weight', you mean parameter, and you want to have a model where the two parameters are equal. If the number of positive and negative events are roughly the same overall, you could just create total = positive_event+negative_event; in a data step, and then fit

     model = total / s;

Note that Y = a + b*total = a + b*(positive_event+negative_event) = a + b*positive_event + b*negative_event,

so now you have a model with equal parameter values. (I am ignoring the random effects for now). The model in your message would be

Y = a + b*positive_event + c*negative_event. If you fit the model with REML (the default), you cannot compare the log-likelihoods of your model and this simpler (reduced) one, because the fixed effects are eliminated from the likelihood. But if you fit both models with ML (method=ML on the procedure statement), you could compare the log-likelihoods with a chi-square test.

Dealing with the random effect makes all of this a bit trickier. For the reduced model, you probably could use:

     random intercept total / subject=id;

If you took this approach, and used ML, the difference in the log-likelihoods (really difference in -2LL) would be based on the difference based on the fixed and random effects. There would be a total of 2 df in the difference of the log-likelihoods, one for the fixed effect and one for the random effect. You would not know automatically which of these two terms dominated the result. There may be another approach where you could focus just on the fixed effects.

Be aware that ML can give somewhat biased parameter estimates, but if you have a large data set, the bias probably will be small.Also note that the use of random coefficient model could take care of the temporal autocorrelations. That is, you might not need the repeated statement in addition to the random statement. You should explore the differences in fit with and without the repeated statement. Or look carefully at the AR parameter value to see if it is close to 0; or compare AIC values with and without the repeated statement.

lvm
Rhodochrosite | Level 12 lvm
Rhodochrosite | Level 12

I want to follow up on my own message... My suggested approach will work best if the two predictors are about the same magnitude. If x1, for instance, consists of large numbers, and x2 consists of numbers near 0, then total (=x1+x2) will be dominated by x1 in the model fitting.  Also, interpretation of the results will be clearest if x1 and x2 are uncorrelated (which is not likely to be true). I am guessing that low correlation would not be too detrimental.

Eran
Calcite | Level 5

Hi Ivm

thank you very much for the detailed answer..... it helps me a lot.

Another thing, with the ML approach can I compare a model with only positive event as predictor to a model with positive event and negative event as predictors (with the X square distribution with 1 [in case of only added fix effect] or 2 [in case of random and fix effect] degree of freedom ?

and lastly, is the difference between the random and the repeated statement that the random statement models the between subject random effect (e.g,. how positive event is associated differently with mood for each subject) and the repeated statement models the within person variation?

Again, thanks a lot

Eran    

lvm
Rhodochrosite | Level 12 lvm
Rhodochrosite | Level 12

You are on the right track with your approach. And in your context, the repeated statement is specifying within-subject variation. But even if you don't use a repeated statement, there is still within-subject variation (a residual variance component).

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 6 replies
  • 1543 views
  • 0 likes
  • 2 in conversation