turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Weight statement in proc mixed causes infinite lik...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

11-01-2014 03:18 PM

Hi everyone,

I am running into problems when using the weight statement in proc mixed. I am trying to run a simple mixed model with two fixed effects (species and canopy_position) and their interaction, along with one random effect. Because of unequal variances between canopy_position groups, I want to run this model with an unstructured variance/covariance matrix, obtained from the repeated statement.

The values for phico2max are associated with some variability. To account for this I introduced the weight statement with the variable phico2max_weight, equal to (1/individual_variance)/(1/total_variance). This gives more power to the more precise (i.e. lower individual_variance) values of phico2max.

This model works when the weight statement is present but the random and repeated statements are left out, or when the random and/or repeated statements are present but the weight statement is left out. If the weight statement is present together with the random or repeated statements, the model fails and the following error message appears in the log:

NOTE: An infinite likelihood is assumed in iteration 0 because of a nonpositive

definite estimated R matrix for Subject 1.

How can I get the weight statement to function with a random statement and unstructured variance/covariance?

proc mixed data=aq; class species canopy_position year;

model phico2max=species|canopy_position;

repeated/type=un;

weight phico2max_weight;

random year;

run;

Accepted Solutions

Solution

11-04-2014
08:34 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to charles_pignon1

11-04-2014 08:34 AM

My belief is that the sum of the weighting factors does not have to equal 1. What happens when you use 1/individual_variance as the weight? Do you still obtain an infinite likelihood error?

Use of type=un in the repeated statement will lead to estimating a covariance between the canopy_position levels, and may be the cause of the infinite likelihood due to (possible only) number of parameters being estimated. What about trying:

repeated /group=canopy_position;

which would estimate a separate residual variance for each level of canopy_position. This is a more common way of modeling heteroskedasticity.

Steve Denham

All Replies

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to charles_pignon1

11-03-2014 09:59 AM

Walk me through the design, and see if I have it correct. You have multiple measures on phico2max, which have been summarized from individual measures, so that you know the total variation and the variation for the measure at that point. If so, then the weight should be 1/individual_variance, if you want unbiased estimates from the procedure.The total_variance will be estimated by the model.

I suspect the infinite likelihood is due to multiple measures within a subject, and you have not specified the subject= option in the repeated statement to disambiguate these multiple measurements. So, one more design question: what is the experimental unit here that has repeated measures? I believe that needs to be captured in your code,

Steve Denham

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to SteveDenham

11-03-2014 06:03 PM

phico2max is a slope derived from linear regression of a Y variable to a X variable. To simplify the model, neither this Y nor this X variable are included, but instead I am running my statistical analysis on the values for phico2max. Therefore each value of phico2max only appears once and has a unique identifier, and there are no repeated measures. The model is then simply phico2max=μ + canopy_position + species + canopy_position*species + year + ε

there is replication within each canopy_position, each species, and each year.

The weight statement is used because each value of phico2max was obtained from a linear regression, and so is associated with a standard error: I want to give more weight to slopes associated with a small standard error, hence the (1/individual_variance)/(1/total_variance).

The unstructured variance/covariance matrix is used because residual variance is unequal between canopy_positions.

The random statement is used because year is considered random.

Using 1/individual_variance as the weighting factor actually allowed the code to run correctly, but I believe that for the weighting factor to be correct the sum of all weighting factors must be equal to 1. This isn't the case if the weighting factor is 1/individual_variance. Does my issue lie in the math, or in the code?

Solution

11-04-2014
08:34 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to charles_pignon1

11-04-2014 08:34 AM

My belief is that the sum of the weighting factors does not have to equal 1. What happens when you use 1/individual_variance as the weight? Do you still obtain an infinite likelihood error?

Use of type=un in the repeated statement will lead to estimating a covariance between the canopy_position levels, and may be the cause of the infinite likelihood due to (possible only) number of parameters being estimated. What about trying:

repeated /group=canopy_position;

which would estimate a separate residual variance for each level of canopy_position. This is a more common way of modeling heteroskedasticity.

Steve Denham

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to SteveDenham

11-04-2014 10:25 AM

As Steve says, there is no reason to rescale the weights. Just use 1/(individual_variance).

Using repeated /type=un

will just give you a single variance (even though you specified unstructed). THis is because you do not have a subject= option. Without this option, each observation is a single subject. If your goal is to have a different weight for each canopy position, then use the code given by Steve:

repeated / group = canopy_position;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

11-05-2014 07:07 PM

Hello,

I looked back into this and you are both right, 1/(individual_variance) works. I was concerned that using weight values that did not sum to 1 would bias the parameter estimates, however it turns out this is not an issue in regression analysis. Separating residual variance between canopy_position is also closer to what I wanted to do (instead of a generalized unstructured variance-covariance matrix). Thanks for your help!

Charles