Intrasubject CV from CI with power to R [Power / Sample Size]

posted by d_labes  – Berlin, Germany, 2010-11-25 11:11 (5321 d 21:49 ago) – Posting: # 6218
Views: 7,744

Dear Earlybird, dear All,

for those who have access to R and have installed the package PowerTOST here an add-on function:
require(PowerTOST)
CVfromCI <- function(point,lower,upper,n,design="2x2",alpha=0.05)
{
  if (missing(lower) | missing(upper)) stop("Lower and upper CL must be given!")
  if (missing(n)) stop("Sample size must be given!")
 
  if (missing(point)) point <- sqrt(lower*upper)
 
  # get design characteristics
  d.no <- .design.no(design)
  if (is.na(d.no)) stop("Unknown design!")
  desi <- .design.props(d.no)
  dfe  <- parse(text=desi$df[1],srcfile=NULL) #degrees of freedom as expression

  tval <- qt(1-alpha,eval(dfe))
  s1 <- (log(point)-log(lower))/sqrt(desi$bk/n)/tval
  s2 <- (log(upper)-log(point))/sqrt(desi$bk/n)/tval
  sw <- 0.5*(s1+s2)
  # both estimates very different?
  if (abs(s1-s2)/sw>0.1) warning("sw1, sw2 very different. Check input.")
  return(se2CV(sw))
}


With this function you can obtain the CV from each design :cool: known within PowerTOST.
This function will be included in the next release of PowerTOST if the author of that package will accept the code :-D. Any enhancement or comment welcome.

Taking the numbers from the first post in this thread and assuming 24 subjects one gets:
CVfromCI(point=1.03,lower=0.93,upper=1.15,n=24,design="2x4x4")
[1] 0.3196356

i.e. CV=32%.

Regards,

Detlew

Complete thread:

UA Flag
Activity
 Admin contact
23,424 posts in 4,927 threads, 1,674 registered users;
84 visitors (0 registered, 84 guests [including 42 identified bots]).
Forum time: 10:00 CEST (Europe/Vienna)

Medical researches can be divided into two sorts:
those who think that meta is better and those
who believe that pooling is fooling.    Stephen Senn

The Bioequivalence and Bioavailability Forum is hosted by
BEBAC Ing. Helmut Schütz
HTML5