{"action":"created","issue":{"url":"https://api.github.com/repos/simple-statistics/simple-statistics/issues/124","labels_url":"https://api.github.com/repos/simple-statistics/simple-statistics/issues/124/labels{/name}","comments_url":"https://api.github.com/repos/simple-statistics/simple-statistics/issues/124/comments","events_url":"https://api.github.com/repos/simple-statistics/simple-statistics/issues/124/events","html_url":"https://github.com/simple-statistics/simple-statistics/issues/124","id":100769918,"number":124,"title":"Proof Ckmeans","user":{"login":"tmcw","id":32314,"avatar_url":"https://avatars.githubusercontent.com/u/32314?v=3","gravatar_id":"","url":"https://api.github.com/users/tmcw","html_url":"https://github.com/tmcw","followers_url":"https://api.github.com/users/tmcw/followers","following_url":"https://api.github.com/users/tmcw/following{/other_user}","gists_url":"https://api.github.com/users/tmcw/gists{/gist_id}","starred_url":"https://api.github.com/users/tmcw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tmcw/subscriptions","organizations_url":"https://api.github.com/users/tmcw/orgs","repos_url":"https://api.github.com/users/tmcw/repos","events_url":"https://api.github.com/users/tmcw/events{/privacy}","received_events_url":"https://api.github.com/users/tmcw/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-08-13T13:32:04Z","updated_at":"2015-08-16T18:09:19Z","closed_at":null,"body":"* Get a instrumented version of the R library working\r\n* Add this result as a testcase https://github.com/simple-statistics/simple-statistics/pull/118#issuecomment-130608728 and figure out what's going on with it"},"comment":{"url":"https://api.github.com/repos/simple-statistics/simple-statistics/issues/comments/131598187","html_url":"https://github.com/simple-statistics/simple-statistics/issues/124#issuecomment-131598187","issue_url":"https://api.github.com/repos/simple-statistics/simple-statistics/issues/124","id":131598187,"user":{"login":"llimllib","id":7150,"avatar_url":"https://avatars.githubusercontent.com/u/7150?v=3","gravatar_id":"","url":"https://api.github.com/users/llimllib","html_url":"https://github.com/llimllib","followers_url":"https://api.github.com/users/llimllib/followers","following_url":"https://api.github.com/users/llimllib/following{/other_user}","gists_url":"https://api.github.com/users/llimllib/gists{/gist_id}","starred_url":"https://api.github.com/users/llimllib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/llimllib/subscriptions","organizations_url":"https://api.github.com/users/llimllib/orgs","repos_url":"https://api.github.com/users/llimllib/repos","events_url":"https://api.github.com/users/llimllib/events{/privacy}","received_events_url":"https://api.github.com/users/llimllib/received_events","type":"User","site_admin":false},"created_at":"2015-08-16T18:09:19Z","updated_at":"2015-08-16T18:09:19Z","body":"I think I fixed it! After [this commit](https://github.com/llimllib/ckmeans/commit/52462a27e806f06af39e437e3afdfae97b7c1c6a) hypothesis still finds some errors, but they appear to be related to MAX_INT and/or floating point checking.\r\n\r\nThe two errors fixed in that commit are:\r\n\r\n* the `withinss` was being calculated incorrectly; `((data_idx - 1) / data_idx) * squared_difference` ignores the first data point (`0/1`) instead of multiplying it by `1/2`\r\n* the mean was being calculated incorrectly. On the second data point, where `data_idx` is 1, `first_cluster_mean` was being set to the sum of the first two numbers instead of half that sum, and so on for each index. subtracting one from `data_idx` does the trick."}}