gabboshow
gabboshow

Reputation: 5579

find not overlapping ranges

I have 2 vectors

Upper_bound =   [421.1706;418.7937;425.9144;431.7096];
Lower_bound =   [376.0487;395.4193;402.7083;419.0457];

Representing the 95% confidence intervals of 4 measurements (A,B,C,D). How can I calculate in an automatic way whether there are significant differences between measures (i.e. 95% confidence intervals do not overlap).

my preferred output would be:

sign_diff = [0 0 0 0; 
             0 0 0 1; 
             0 0 0 0; 
             0 1 0 0];

Indicating that A does not differ from A,B,C,D.

B does not differ from A,B,C but it differs from D.

etc.

Thanks

Upvotes: 0

Views: 75

Answers (2)

Dennis Klopfer
Dennis Klopfer

Reputation: 769

Taking Shai's answer:

sign_diff = ~(bsxfun( @le, Lower_bound, Upper_bound' ) &...
             bsxfun( @ge, Upper_bound, Lower_bound' ))

I can't comment yet, so I post it as answer.

Upvotes: 0

Shai
Shai

Reputation: 114926

You can use to do the computation

sign_diff = bsxfun( @ge, Lower_bound, Upper_bound' ) |...
            bsxfun( @le, Upper_bound, Lower_bound' )

Results with:

sign_diff =
 0     0     0     0
 0     0     0     1
 0     0     0     0
 0     1     0     0

Upvotes: 3

Related Questions