BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
UcheOkoro
Lapis Lazuli | Level 10

Please, I need help calculating the confidence interval for a median. I keep getting the following error messages.


"WARNING: Heterogeneous covariance estimate is degenerate. Confidence limits for QUANTILE= 0.5
cannot be computed.
WARNING: Heterogeneous covariance estimate is degenerate. Covariance and correlation for
QUANTILE= 0.5 cannot be computed."

I have tried CI=Sparsity, Rank and resampling but none could give me the confidence interval. 

The following is my SAS code 

Thank you.

 

proc quantreg data=VENT.Ventilation_data10  ;
   class after_intervention ;
   model icu_peep=after_intervention / quantile=0.5;
   estimate 'Diff in Medians' after_intervention 1 -1 / CL;
   BY BMI2;
run;


 

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

> Please, what would you suggest?

I do not know. Your data appeared to be binned to the nearest integer. Binned data always presents challenges to quantile-based computations. For BMI2=1, it looks like the two groups have exactly the same median and have many duplicate values. Tied values also present many challenges for quantile routines.

 

Clearly, your data are degenerate for some BY groups and the procedure cannot estimate the quantities necessary for the CL because a certain covariance matrix is singular. 

 

If you are willing to try a wild suggestion, you might think about using the smooth bootstrap. You would jitter the icu_peep variable by adding a small random noise to each value. For example, if you think that the response that has the value k is actually uniformly distributed in the interval (k-1/2, k+0.5], you could try adding a random value in [-0.5, 0.5], like this:


data Want;

set VENT.Ventilation_Data10;
call streaminit(123);

icu_peep_jit = icu_peep + rand("Uniform", -0.5, 0.5);

run;

 

You could then analyze the icu_peep_jit variable. I am curious if that resolves the problem. If so, this suggests using a bootstrap-type approach with jittered data, which is called the smooth bootstrap.

View solution in original post

7 REPLIES 7
UcheOkoro
Lapis Lazuli | Level 10

Thank you for your response. The link you attached provides the same SAS code I used that gave me the warning with no confidence interval.

Rick_SAS
SAS Super FREQ

Your SAS statements include a BY statement, so presumably the log includes one or more notes that contains information about the BY-group where the data are degenerate. For example, look for a note that says something like,  "The previous warnings for for BY-group BMI2=<value>."  That BY group is degenerate.

 

You can also investigate the the issue graphically. Create box plots of the data (or at least for the BY-groups that are causing the problem):

 

proc sgplot data=VENT.Ventilation_data10  ;
/* optional: WHERE BMI2 in (set of BY groups that give the warnings); */ vbox icu_peep / group=after_intervention; BY BMI2; run;

Probably that method will enable you to figure out what is going on. For example, one of the BY-groups might have only a one unique value for one of the levels of after_intervention.

 

UcheOkoro
Lapis Lazuli | Level 10

Thank you so much for the response. The BMI2 level 1 box plot for the after_intervention=0 does not have an upper or lower whisker, or an upper or lower quantile.  The BMI2 level 2 and 3 box plot for the after_intervention=0 do not have the lower whisker but level 3 has a CI calculated but 2 does not.

Find below the boxplots and the SAS log statements. Please, what would you suggest?

UcheOkoro_3-1657295358920.png

 

 

UcheOkoro_0-1657295135618.png

 

UcheOkoro_1-1657295174076.pngUcheOkoro_2-1657295251579.png

Without the by statement

UcheOkoro_5-1657295884674.png

 

UcheOkoro_4-1657295807739.png

 

 

Rick_SAS
SAS Super FREQ

> Please, what would you suggest?

I do not know. Your data appeared to be binned to the nearest integer. Binned data always presents challenges to quantile-based computations. For BMI2=1, it looks like the two groups have exactly the same median and have many duplicate values. Tied values also present many challenges for quantile routines.

 

Clearly, your data are degenerate for some BY groups and the procedure cannot estimate the quantities necessary for the CL because a certain covariance matrix is singular. 

 

If you are willing to try a wild suggestion, you might think about using the smooth bootstrap. You would jitter the icu_peep variable by adding a small random noise to each value. For example, if you think that the response that has the value k is actually uniformly distributed in the interval (k-1/2, k+0.5], you could try adding a random value in [-0.5, 0.5], like this:


data Want;

set VENT.Ventilation_Data10;
call streaminit(123);

icu_peep_jit = icu_peep + rand("Uniform", -0.5, 0.5);

run;

 

You could then analyze the icu_peep_jit variable. I am curious if that resolves the problem. If so, this suggests using a bootstrap-type approach with jittered data, which is called the smooth bootstrap.

UcheOkoro
Lapis Lazuli | Level 10

It worked! Thank you so much for taking time to respond. I am very grateful.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 7 replies
  • 1490 views
  • 2 likes
  • 4 in conversation