{"action":"created","issue":{"url":"https://api.github.com/repos/markmfredrickson/RItools/issues/39","labels_url":"https://api.github.com/repos/markmfredrickson/RItools/issues/39/labels{/name}","comments_url":"https://api.github.com/repos/markmfredrickson/RItools/issues/39/comments","events_url":"https://api.github.com/repos/markmfredrickson/RItools/issues/39/events","html_url":"https://github.com/markmfredrickson/RItools/issues/39","id":122587391,"number":39,"title":"cluster branch versus master branch differences ","user":{"login":"jwbowers","id":569932,"avatar_url":"https://avatars.githubusercontent.com/u/569932?v=3","gravatar_id":"","url":"https://api.github.com/users/jwbowers","html_url":"https://github.com/jwbowers","followers_url":"https://api.github.com/users/jwbowers/followers","following_url":"https://api.github.com/users/jwbowers/following{/other_user}","gists_url":"https://api.github.com/users/jwbowers/gists{/gist_id}","starred_url":"https://api.github.com/users/jwbowers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwbowers/subscriptions","organizations_url":"https://api.github.com/users/jwbowers/orgs","repos_url":"https://api.github.com/users/jwbowers/repos","events_url":"https://api.github.com/users/jwbowers/events{/privacy}","received_events_url":"https://api.github.com/users/jwbowers/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-12-16T19:49:28Z","updated_at":"2015-12-17T15:22:35Z","closed_at":"2015-12-17T15:22:35Z","body":"This may be something that Mark already knows about. However, just in case it is news, I'll add it here.\r\n\r\nThe results differ between the master branch and the cluster branch. \r\n\r\n## Master branch\r\n\r\nIn the master branch the adj.diff is the harmonic weighted diff of means, see below how `lm` produces the same answer as `xBalance`.\r\n\r\n```\r\nnuclearplants$ptF<-factor(nuclearplants$pt)\r\n> xb<-xBalance(pr~t1,strata=list(pt=~ptF,unstrat=NULL),data=nuclearplants,report=\"all\")\r\n> xb\r\n     strata     pt                                                          unstrat\r\n     stat     pr=0   pr=1 adj.diff adj.diff.null.sd std.diff    z              pr=0   pr=1 adj.diff adj.diff.null.sd std.diff    z\r\nvars\r\nt1          13.395 14.349   0.953            1.204    0.279   0.792          13.636 14.000   0.364            1.285    0.106   0.283\r\n---Overall Test---\r\n        chisquare df p.value\r\npt         0.6270  1   0.428\r\nunstrat    0.0801  1   0.777\r\n\r\n> lm(t1~pr+ptF,data=nuclearplants)\r\n\r\nCall:\r\nlm(formula = t1 ~ pr + ptF, data = nuclearplants)\r\n\r\nCoefficients:\r\n(Intercept)           pr         ptF1\r\n    14.1279       0.9535      -3.6047\r\n```\r\n\r\n## Cluster branch (New Randomization-Distribution branch)\r\nThe cluster branch does not do what I expect (i.e. same as `lm` or previous `xBalance`).\r\n\r\n```\r\n> nuclearplants$ptF<-factor(nuclearplants$pt)\r\n> xb<-xBalance(pr~t1+strata(ptF),data=nuclearplants,report=\"all\")\r\n> xb\r\n     strata       ptF                                             Unstrat\r\n     stat   Treatment Control adj.diff std.diff    z            Treatment Control adj.diff std.diff    z\r\nvars\r\nt1            14.0000 13.8310  0.1690   0.0457  0.7918            14.0000 13.6364  0.3636   0.0982  0.2830\r\n---Overall Test---\r\n        chisquare df       p.value\r\nptF     \"0.6270\"  \"1.0000\" \"0.8569\"\r\nUnstrat \"0.0801\"  \"1.0000\" \"0.8569\"\r\n```\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/markmfredrickson/RItools/issues/comments/165482095","html_url":"https://github.com/markmfredrickson/RItools/issues/39#issuecomment-165482095","issue_url":"https://api.github.com/repos/markmfredrickson/RItools/issues/39","id":165482095,"user":{"login":"benthestatistician","id":827606,"avatar_url":"https://avatars.githubusercontent.com/u/827606?v=3","gravatar_id":"","url":"https://api.github.com/users/benthestatistician","html_url":"https://github.com/benthestatistician","followers_url":"https://api.github.com/users/benthestatistician/followers","following_url":"https://api.github.com/users/benthestatistician/following{/other_user}","gists_url":"https://api.github.com/users/benthestatistician/gists{/gist_id}","starred_url":"https://api.github.com/users/benthestatistician/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benthestatistician/subscriptions","organizations_url":"https://api.github.com/users/benthestatistician/orgs","repos_url":"https://api.github.com/users/benthestatistician/repos","events_url":"https://api.github.com/users/benthestatistician/events{/privacy}","received_events_url":"https://api.github.com/users/benthestatistician/received_events","type":"User","site_admin":false},"created_at":"2015-12-17T15:22:35Z","updated_at":"2015-12-17T15:22:35Z","body":"`control.avg` is a standardized average (in the [epidemiologists' sense](http://sphweb.bumc.bu.edu/otlt/MPH-Modules/EP/EP713_StandardizedRates/EP713_StandardizedRates4.html) ) of control observations, using the treatment group as the standard population. In other words, a weighted average over the control group, with each control weighted in proportion to the ratio of treatments to controls within its stratum.  \r\n\r\nI think that's actually quite a bit easier to explain and understand than the harmonic mean standardization we've been leaning on up to now.  That's one reason I pushed for this change, the other being that the [What Works Clearinghouse's Procedures and Standards Handbook](http://ies.ed.gov/ncee/wwc/documentsum.aspx?sid=19) appears to require it in order for experiments or quasiexperiments to declared to have met their standards with or without reservations, and we'd like for RItools to support that sort of work.\r\n\r\nIt's important to emphasize that, because we're still using harmonic weights for the inferential statistics, we'll continue to get their precision benefits for tests and confidence intervals formed via `xBalance`. \r\n\r\n(I'm going to go ahead and close this out, in the interest of task list tidiness; do reopen if you deem appropriate.)"}}