{"comment":{"created_at":"2011-10-25T12:43:51Z","body":"Thanks, Mark. No need for another p value function; I hadn't seen those. Ben\n\n----- Reply message -----\nFrom: \"Mark Fredrickson\" <reply@reply.github.com>\nDate: Mon, Oct 24, 2011 10:11 pm\nSubject: [RItools] one and two sided confidence intervals (#11)\nTo: \"Ben\" <bbh@umich.edu>\n\nUsers can specify `include.distribution = T` to get the raw data. No other function yet takes advantage of these data, if included, but it would make sense to extend the confint method to allow a different p-value function if the data are there.\n\nAlso, do we need another p-value function other than `lower.p.value`, which is implemented as:\n\n```\nsimple.p.value <- function(value, distribution, lower.tail = FALSE) {\n  if (lower.tail) {\n    mean(distribution <= value)\n  } else { \n    mean(distribution >= value)\n  }\n}\n\nupper.p.value <- function(value, distribution) { simple.p.value(value, distribution, FALSE) }\nlower.p.value <- function(value, distribution) { simple.p.value(value, distribution, TRUE) }\n```\n\n-- \nReply to this email directly or view it on GitHub:\nhttps://github.com/markmfredrickson/RItools/issues/11#issuecomment-2512143\n\n\n","updated_at":"2011-10-25T12:43:51Z","url":"https://api.github.com/repos/markmfredrickson/RItools/issues/comments/2516506","id":2516506,"user":{"avatar_url":"https://secure.gravatar.com/avatar/18eab2790929c0ff7ed758337a4db684?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"18eab2790929c0ff7ed758337a4db684","url":"https://api.github.com/users/benthestatistician","id":827606,"login":"benthestatistician"}},"action":"created","issue":{"number":11,"created_at":"2011-10-23T14:01:11Z","pull_request":{"diff_url":null,"patch_url":null,"html_url":null},"body":"How should we support one-sided confidence intervals? Right now the code uses the two tailed p value and excludes the hypothesis from the interval if (1-p) > level where p is the two-tailed p. I hesitate to just add a `switch` or set of `if` to the nice edifice that Mark is building.  Yet spawning mini-methods seems inelegant. So I have not taken this simple task into my own hands ---- yet I think we'll want this capability. \r\n\r\nHere is the current code (from the commit of the randomization distribution branch before Mark did the big change):\r\n\r\n```\r\nconfint.ParameterizedRandomizationDistribution <- function(\r\n  object,\r\n  param,\r\n  level = 0.95,\r\n  p.value.function = general.two.sided.p.value) {\r\n  \r\n  pvs <- p.values(object, p.value.function) \r\n  \r\n  reject <- (1 - pvs$p) > level\r\n  results <- cbind(object@params, reject[-1]) # drop the null\r\n   \r\n  return(new(\"ParameterizedRandomizationDistributionConfInt\", prd = object,\r\n    rejections = results))\r\n}\r\n```","comments":5,"title":"one and two sided confidence intervals","updated_at":"2011-10-25T12:43:51Z","url":"https://api.github.com/repos/markmfredrickson/RItools/issues/11","id":2026758,"assignee":null,"milestone":null,"closed_at":null,"user":{"avatar_url":"https://secure.gravatar.com/avatar/a8323230dfb8f17423b1bb7a70a515d0?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"a8323230dfb8f17423b1bb7a70a515d0","url":"https://api.github.com/users/jwbowers","id":569932,"login":"jwbowers"},"html_url":"https://github.com/markmfredrickson/RItools/issues/11","labels":[],"state":"open"},"legacy":{"issue_id":2026758,"comment_id":2516506}}