{"action":"created","issue":{"url":"https://api.github.com/repos/harrelfe/Hmisc/issues/22","labels_url":"https://api.github.com/repos/harrelfe/Hmisc/issues/22/labels{/name}","comments_url":"https://api.github.com/repos/harrelfe/Hmisc/issues/22/comments","events_url":"https://api.github.com/repos/harrelfe/Hmisc/issues/22/events","html_url":"https://github.com/harrelfe/Hmisc/issues/22","id":63238328,"number":22,"title":"wtd.var: normwt and documentation","user":{"login":"tyner","id":3537845,"avatar_url":"https://avatars.githubusercontent.com/u/3537845?v=3","gravatar_id":"","url":"https://api.github.com/users/tyner","html_url":"https://github.com/tyner","followers_url":"https://api.github.com/users/tyner/followers","following_url":"https://api.github.com/users/tyner/following{/other_user}","gists_url":"https://api.github.com/users/tyner/gists{/gist_id}","starred_url":"https://api.github.com/users/tyner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tyner/subscriptions","organizations_url":"https://api.github.com/users/tyner/orgs","repos_url":"https://api.github.com/users/tyner/repos","events_url":"https://api.github.com/users/tyner/events{/privacy}","received_events_url":"https://api.github.com/users/tyner/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-03-20T14:25:40Z","updated_at":"2015-04-20T02:21:46Z","closed_at":null,"body":"I noticed one of the changes in version 3.14-6 (2014-11-16):\r\n> wtd.var: corrected denominator.  Thanks: Shan Huang\r\n\r\nWhile I agree that the previous denominator was incorrect, I would also add that new denominator causes the return value to no longer depend on the value of the 'normwt' argument (which can be proved with a little algebra).\r\n\r\nOn the other hand, the documentation for this function suggests that 'normwt' is supposed to have an effect:\r\n> When normwt=FALSE the weighted variance will not equal the unweighted variance even if the weights are identical. That is because of the subtraction of 1 from the sum of the weights in the denominator of the variance formula. If you want the weighted variance to equal the unweighted variance when weights do not vary, use normwt=TRUE.\r\n\r\nSo, does the documentation need to be updated? Or perhaps the change to the denominator was too heavy-handed?"},"comment":{"url":"https://api.github.com/repos/harrelfe/Hmisc/issues/comments/94341379","html_url":"https://github.com/harrelfe/Hmisc/issues/22#issuecomment-94341379","issue_url":"https://api.github.com/repos/harrelfe/Hmisc/issues/22","id":94341379,"user":{"login":"harrelfe","id":1150682,"avatar_url":"https://avatars.githubusercontent.com/u/1150682?v=3","gravatar_id":"","url":"https://api.github.com/users/harrelfe","html_url":"https://github.com/harrelfe","followers_url":"https://api.github.com/users/harrelfe/followers","following_url":"https://api.github.com/users/harrelfe/following{/other_user}","gists_url":"https://api.github.com/users/harrelfe/gists{/gist_id}","starred_url":"https://api.github.com/users/harrelfe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harrelfe/subscriptions","organizations_url":"https://api.github.com/users/harrelfe/orgs","repos_url":"https://api.github.com/users/harrelfe/repos","events_url":"https://api.github.com/users/harrelfe/events{/privacy}","received_events_url":"https://api.github.com/users/harrelfe/received_events","type":"User","site_admin":false},"created_at":"2015-04-20T02:21:46Z","updated_at":"2015-04-20T02:21:46Z","body":"Excellent.  Thanks very much.   I incorporated all that and added you as an author in the help file.  If you want me to include an affiliation and/or and e-mail address please let me know what to put (by private email if you want: f.harrell@vanderbilt.edu).  This will be in the upcoming release to CRAN in several days.  I made a couple of small changes to your code.  Please check the function if you have time.  I ran one test:\r\n\r\n    x=c(1,3,5,6)\r\n    wtd.var(x)\r\n    [1] 4.916667\r\n    w=c(1,1,1,3)\r\n    wtd.var(x, w, method='un')\r\n    4.3\r\n    wtd.var(x, w, method='ML')\r\n    [1] 3.583333\r\n    var(c(1,3,5,6,6,6))\r\n    [1] 4.3\r\n"}}