Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

euclidian distance line 142 in abc.R #1

Open
EwenBurban opened this issue Dec 23, 2022 · 0 comments
Open

euclidian distance line 142 in abc.R #1

EwenBurban opened this issue Dec 23, 2022 · 0 comments

Comments

@EwenBurban
Copy link

Hi,
I found a bug in the calculation of the euclidian distance in the script abc.R.
I detailed the error ( it’s very subtle but the impact is huge, at least for me) in the following R script.
I hope I’ve detailed the bug correctly.

target=iris[1,1:4]
sumstat=iris[-1,1:4]
### wrong way (used in abc package in abc.R script line 142)

wrong_diff = sumstat[,1] - target[1]
### correct way 
correct_diff = sumstat[,1] - target[,1]

print(paste('the wrong way produce only',length(wrong_diff),' value'))
print(paste('the correct way produce',length(correct_diff),' values'))

## the wrong way is similar to write
test= sumstat[,1] - target[1,1]
print(test==wrong_diff)
## so actually, the gfit function calculate the godness of fit as the euclidian distance between the 
## first element of the reference table and the target rather than the mean distance between the reference 
## table and the target

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant