# The precision recall AUCs calculated by two different packages are different?

I used the dataset cars as an example

library("MLmetrics")
library("PRROC")
data(cars)
logreg <- glm(formula = vs ~ hp + wt,
family = binomial(link = "logit"), data = mtcars)


The prauc returned by PRAUC is 0.861

PRAUC(y_pred = logreg$fitted.values, y_true = mtcars$vs)


However, the prauc returned by pr.curve is 0.932

pr.curve(scores.class0 = logreg$fitted.values, weights.class0 = mtcars$vs)


Is there anything wrong?

The correct one is pr.curve. If you return the curve from it (via curve=T option) and plot at the values (see below), the area over the region contains approximately $$53$$ squares of area $$(1/28)^2$$, which has area approximately $$0.067$$, which means under it the area is nearly $$0.93$$.
Sometimes, when the dataset is small, area calculation method matters, which is probably poorly implemented in MLmetrics.