{"action":"created","issue":{"url":"https://api.github.com/repos/stats4sd/Sampling-Decision-Assistant/issues/165","repository_url":"https://api.github.com/repos/stats4sd/Sampling-Decision-Assistant","labels_url":"https://api.github.com/repos/stats4sd/Sampling-Decision-Assistant/issues/165/labels{/name}","comments_url":"https://api.github.com/repos/stats4sd/Sampling-Decision-Assistant/issues/165/comments","events_url":"https://api.github.com/repos/stats4sd/Sampling-Decision-Assistant/issues/165/events","html_url":"https://github.com/stats4sd/Sampling-Decision-Assistant/issues/165","id":322275825,"number":165,"title":"Review sampling stage calculator code for cases when single stage","user":{"login":"chrismclarke","id":10515065,"avatar_url":"https://avatars1.githubusercontent.com/u/10515065?v=4","gravatar_id":"","url":"https://api.github.com/users/chrismclarke","html_url":"https://github.com/chrismclarke","followers_url":"https://api.github.com/users/chrismclarke/followers","following_url":"https://api.github.com/users/chrismclarke/following{/other_user}","gists_url":"https://api.github.com/users/chrismclarke/gists{/gist_id}","starred_url":"https://api.github.com/users/chrismclarke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrismclarke/subscriptions","organizations_url":"https://api.github.com/users/chrismclarke/orgs","repos_url":"https://api.github.com/users/chrismclarke/repos","events_url":"https://api.github.com/users/chrismclarke/events{/privacy}","received_events_url":"https://api.github.com/users/chrismclarke/received_events","type":"User","site_admin":false},"labels":[{"id":751490579,"url":"https://api.github.com/repos/stats4sd/Sampling-Decision-Assistant/labels/next","name":"next","color":"ededed","default":false},{"id":751434327,"url":"https://api.github.com/repos/stats4sd/Sampling-Decision-Assistant/labels/question","name":"question","color":"cc317c","default":true}],"state":"open","locked":false,"assignee":{"login":"chrismclarke","id":10515065,"avatar_url":"https://avatars1.githubusercontent.com/u/10515065?v=4","gravatar_id":"","url":"https://api.github.com/users/chrismclarke","html_url":"https://github.com/chrismclarke","followers_url":"https://api.github.com/users/chrismclarke/followers","following_url":"https://api.github.com/users/chrismclarke/following{/other_user}","gists_url":"https://api.github.com/users/chrismclarke/gists{/gist_id}","starred_url":"https://api.github.com/users/chrismclarke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrismclarke/subscriptions","organizations_url":"https://api.github.com/users/chrismclarke/orgs","repos_url":"https://api.github.com/users/chrismclarke/repos","events_url":"https://api.github.com/users/chrismclarke/events{/privacy}","received_events_url":"https://api.github.com/users/chrismclarke/received_events","type":"User","site_admin":false},"assignees":[{"login":"chrismclarke","id":10515065,"avatar_url":"https://avatars1.githubusercontent.com/u/10515065?v=4","gravatar_id":"","url":"https://api.github.com/users/chrismclarke","html_url":"https://github.com/chrismclarke","followers_url":"https://api.github.com/users/chrismclarke/followers","following_url":"https://api.github.com/users/chrismclarke/following{/other_user}","gists_url":"https://api.github.com/users/chrismclarke/gists{/gist_id}","starred_url":"https://api.github.com/users/chrismclarke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrismclarke/subscriptions","organizations_url":"https://api.github.com/users/chrismclarke/orgs","repos_url":"https://api.github.com/users/chrismclarke/repos","events_url":"https://api.github.com/users/chrismclarke/events{/privacy}","received_events_url":"https://api.github.com/users/chrismclarke/received_events","type":"User","site_admin":false},{"login":"sdumble1","id":27428197,"avatar_url":"https://avatars1.githubusercontent.com/u/27428197?v=4","gravatar_id":"","url":"https://api.github.com/users/sdumble1","html_url":"https://github.com/sdumble1","followers_url":"https://api.github.com/users/sdumble1/followers","following_url":"https://api.github.com/users/sdumble1/following{/other_user}","gists_url":"https://api.github.com/users/sdumble1/gists{/gist_id}","starred_url":"https://api.github.com/users/sdumble1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sdumble1/subscriptions","organizations_url":"https://api.github.com/users/sdumble1/orgs","repos_url":"https://api.github.com/users/sdumble1/repos","events_url":"https://api.github.com/users/sdumble1/events{/privacy}","received_events_url":"https://api.github.com/users/sdumble1/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/stats4sd/Sampling-Decision-Assistant/milestones/7","html_url":"https://github.com/stats4sd/Sampling-Decision-Assistant/milestone/7","labels_url":"https://api.github.com/repos/stats4sd/Sampling-Decision-Assistant/milestones/7/labels","id":3282781,"number":7,"title":"1.0.0","description":"first public beta for sharing with local audience and partners","creator":{"login":"chrismclarke","id":10515065,"avatar_url":"https://avatars1.githubusercontent.com/u/10515065?v=4","gravatar_id":"","url":"https://api.github.com/users/chrismclarke","html_url":"https://github.com/chrismclarke","followers_url":"https://api.github.com/users/chrismclarke/followers","following_url":"https://api.github.com/users/chrismclarke/following{/other_user}","gists_url":"https://api.github.com/users/chrismclarke/gists{/gist_id}","starred_url":"https://api.github.com/users/chrismclarke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrismclarke/subscriptions","organizations_url":"https://api.github.com/users/chrismclarke/orgs","repos_url":"https://api.github.com/users/chrismclarke/repos","events_url":"https://api.github.com/users/chrismclarke/events{/privacy}","received_events_url":"https://api.github.com/users/chrismclarke/received_events","type":"User","site_admin":false},"open_issues":15,"closed_issues":32,"state":"open","created_at":"2018-04-19T23:28:48Z","updated_at":"2018-05-11T12:17:02Z","due_on":"2018-04-30T07:00:00Z","closed_at":null},"comments":1,"created_at":"2018-05-11T12:17:02Z","updated_at":"2018-05-11T12:48:38Z","closed_at":null,"author_association":"OWNER","body":"How should the sample number be calculated when there is only 1 stage?\n\nI assume this is much simpler, but can it be calculated from existing code? \n\nAlso, currently number of stages variable doesn't seem to be used in the code anywhere, should it?\n\ncurrent code (javascript, but v similar to R):\n\n if (input.type == \"average value\") {\n                SRSn = (input.sd * qnorm(1 - (1 - input.conf) / 2) / input.moe) ** 2\n            }\n            if (input.type == \"proportion\") {\n                p1 = input.prop / 100\n                moe = input.moe / 100\n                SRSn = (Math.sqrt(p1 * (1 - p1)) * qnorm(1 - (1 - input.conf) / 2) / moe) ** 2\n            }\n            SRSn_FPC = Math.ceil((SRSn * input.Population) / (SRSn + input.Population - 1))\n            DEFF1 = (1 + (input.nHH - 1) * input.rho)\n            FinalstageN = SRSn * DEFF1\n            FinalstageN_FPC = Math.ceil((FinalstageN * input.Population) / (FinalstageN + input.Population - 1))\n            stage2N = Math.ceil(FinalstageN_FPC / input.nHH)"},"comment":{"url":"https://api.github.com/repos/stats4sd/Sampling-Decision-Assistant/issues/comments/388353746","html_url":"https://github.com/stats4sd/Sampling-Decision-Assistant/issues/165#issuecomment-388353746","issue_url":"https://api.github.com/repos/stats4sd/Sampling-Decision-Assistant/issues/165","id":388353746,"user":{"login":"chrismclarke","id":10515065,"avatar_url":"https://avatars1.githubusercontent.com/u/10515065?v=4","gravatar_id":"","url":"https://api.github.com/users/chrismclarke","html_url":"https://github.com/chrismclarke","followers_url":"https://api.github.com/users/chrismclarke/followers","following_url":"https://api.github.com/users/chrismclarke/following{/other_user}","gists_url":"https://api.github.com/users/chrismclarke/gists{/gist_id}","starred_url":"https://api.github.com/users/chrismclarke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrismclarke/subscriptions","organizations_url":"https://api.github.com/users/chrismclarke/orgs","repos_url":"https://api.github.com/users/chrismclarke/repos","events_url":"https://api.github.com/users/chrismclarke/events{/privacy}","received_events_url":"https://api.github.com/users/chrismclarke/received_events","type":"User","site_admin":false},"created_at":"2018-05-11T12:48:38Z","updated_at":"2018-05-11T12:48:38Z","author_association":"OWNER","body":"Great, exactly what I was hoping\r\n\r\nChris\r\n\r\nFrom: sdumble1 <notifications@github.com>\r\nSent: 11 May 2018 13:47\r\nTo: stats4sd/Sampling-Decision-Assistant <Sampling-Decision-Assistant@noreply.github.com>\r\nCc: Chris Clarke <chris.m.clarke@live.co.uk>; Assign <assign@noreply.github.com>\r\nSubject: Re: [stats4sd/Sampling-Decision-Assistant] Review sampling stage calculator code for cases when single stage (#165)\r\n\r\n\r\nIf there's only 1 stage you basically just stop doing calculations half way through - since there is no design effect, or number of clusters to be calculated. Probably worth explicitly pointing that out in the output, so define those values to be NA.\r\n\r\nSo something like this - assuming you have a variable called something like nstages?\r\n\r\nif (input.type == \"average value\") {\r\nSRSn = (input.sd * qnorm(1 - (1 - input.conf) / 2) / input.moe) ** 2\r\n}\r\nif (input.type == \"proportion\") {\r\np1 = input.prop / 100\r\nmoe = input.moe / 100\r\nSRSn = (Math.sqrt(p1 * (1 - p1)) * qnorm(1 - (1 - input.conf) / 2) / moe) ** 2\r\n}\r\nSRSn_FPC = Math.ceil((SRSn * input.Population) / (SRSn + input.Population - 1))\r\nif (nstages=1){\r\nFinalstageN = SRSn\r\nFinalstageN_FPC = SRSn_FPC\r\nDEFF1 = NA\r\nstage2N = NA\r\n}\r\nif (nstages>1)\r\nDEFF1 = (1 + (input.nHH - 1) * input.rho)\r\nFinalstageN = SRSn * DEFF1\r\nFinalstageN_FPC = Math.ceil((FinalstageN * input.Population) / (FinalstageN + input.Population - 1))\r\nstage2N = Math.ceil(FinalstageN_FPC / input.nHH)\r\n}\r\n\r\n—\r\nYou are receiving this because you were assigned.\r\nReply to this email directly, view it on GitHub<https://github.com/stats4sd/Sampling-Decision-Assistant/issues/165#issuecomment-388353369>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AKByeTr_hmtpdwDV0wTPz1AMelJz7Xgoks5txYhFgaJpZM4T7XlQ>.\r\n"}}
{"actor":{"display_login":"chrismclarke"}}