Hi everyone,
I am analyzing yield trait where a positive value makes sense. The LSMEANS statement in PROC MIXED returns some treatment with negative values. What do I do to prevent from having negative values? What does it mean to have LSMEANS to be negative? My script is as follows:
Thanks
You can't force an LSMEANS estimate to be positive. If the math produces a negative LSMEANS value, then that is what you get (and as a side issue, I'm pretty confident that SAS has done thorough quality control on their procedures and the negative number is correct; although certainly bugs do happen). Sometimes this can happen because you have very little data in one cell and large amounts of data in another cell, or perhaps because you have mis-specified the model, or because your x-variables are highly co-linear.
By the way, have you checked your input data to make sure you don't have negative values by mistake?
If you can't narrow it down to one of the above causes, then you might want to share your data set with SAS technical support and see what explanation they can come up with.
You can't force an LSMEANS estimate to be positive. If the math produces a negative LSMEANS value, then that is what you get (and as a side issue, I'm pretty confident that SAS has done thorough quality control on their procedures and the negative number is correct; although certainly bugs do happen). Sometimes this can happen because you have very little data in one cell and large amounts of data in another cell, or perhaps because you have mis-specified the model, or because your x-variables are highly co-linear.
By the way, have you checked your input data to make sure you don't have negative values by mistake?
If you can't narrow it down to one of the above causes, then you might want to share your data set with SAS technical support and see what explanation they can come up with.
Thanks for the prompt response. I suspect that I have few data points in some cells. That is likely to be the reason.
Thanks
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.