BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
andrii
Calcite | Level 5

Hi!
I am trying to calculate Bray Curtis Dissimilarity in SAS by proc distance.

I found an example on the next page:https://www.statisticshowto.datasciencecentral.com/bray-curtis-dissimilarity/

According to the Formula, the result must be 0.39
The same numbers I am getting in the R vegan.

Proc distance producing different results.

data c;
infile datalines;
input id $ A1 A2 A3 ;
datalines;
Fish_1 6 7 4
Fish_2 10 0 6
;
run;
proc distance data=c method=blwnm; 
var ANOMINAL( A: ) ;
id id;
run;

Results:

idFish_1Fish_2
Fish_10 
Fish_20,60


What am I doing wrong here?

Thanks,
   Andrii

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

Hi @andrii and welcome to the SAS Support Communities!

 

Thanks for this interesting question. I didn't know this specific dissimilarity measure.

 

In the PROC DISTANCE documentation (close to the bottom of that page) I found that the formula SAS uses with method=blwnm is not equivalent to your linked formula. However, SAS provides an equivalent formula with method=nonmetric. Actually, the formula looks different, but it's an easy exercise to show that it's equivalent (hint: abs(x-y)=x+y-2*min(x,y)).

 

So, in order to replicate your result, use this code:

proc distance data=c out=want method=nonmetric;
var ratio(a:);
id id;
run;

(Note that level "ratio" is required for method=nonmetric.)

View solution in original post

2 REPLIES 2
FreelanceReinh
Jade | Level 19

Hi @andrii and welcome to the SAS Support Communities!

 

Thanks for this interesting question. I didn't know this specific dissimilarity measure.

 

In the PROC DISTANCE documentation (close to the bottom of that page) I found that the formula SAS uses with method=blwnm is not equivalent to your linked formula. However, SAS provides an equivalent formula with method=nonmetric. Actually, the formula looks different, but it's an easy exercise to show that it's equivalent (hint: abs(x-y)=x+y-2*min(x,y)).

 

So, in order to replicate your result, use this code:

proc distance data=c out=want method=nonmetric;
var ratio(a:);
id id;
run;

(Note that level "ratio" is required for method=nonmetric.)

andrii
Calcite | Level 5

Hi @FreelanceReinh 

Yes, it exactly what I have been looking for!

Thanks a lot!

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1241 views
  • 1 like
  • 2 in conversation