Cadmium [🇷 for BE/BA]

posted by ElMaestro  – Denmark, 2011-01-19 18:50 (5226 d 16:27 ago) – Posting: # 6451
Views: 30,343

Ahoy dlabes,

always a pleasure reading posts from you; I understand so little...

❝ Theoretically the power of scaled ABE evaluation (if it could be done exact :cool:) and therefore the sample size is independent of the variability.


This thing about 'If it could be done exact :cool:' just made me wonder. Of course power calculations with computers is not an exact business but I will in the following not be discussing the 17th decimal.

If I get you right you are looking for the answer to this question:
If we have a power of P at T/R=soandso and CV being thisorthat, then what should the accetance range be if the CV is not thisorthat but blahblah?

In principle, the EMA guideline provides the answer to that Question as it allows a construct of a curve of acceptance range versus CV. But trying to decipher your encrypted babblings, you're saying this is an approximation given that power should be the constant.
Allow me to return to the famous german desert and ingestion of clothing, but this time garnished with some heavy metal (I use the simple example of a 2,2,2-design although this is not the relevant one for scaling but it can be adapted pretty easily):

EatMyShorts <- function (x, V, T, W)
{
 
  l1 = pnorm((T*x/sqrt(V)) - W);
 
  l2 = (V-1.0)*log(x) -lgamma(0.5*V) - (0.5*(V-2.0))* log (2.0);
  l3 = exp(l2);
  l4 =dnorm(x);
  l1*l3*l4;
 
}

Apfelstrudel<-function(t, df, ta, tb, ncp, ACCURACY)
{
  L1 = sqrt(2*pi);
  P=0;
  step = (tb-ta)/ACCURACY;
  foo=ta;
  for (i in 1:ACCURACY)
    {
      y1 = EatMyShorts(foo, df, t, ncp);
      y2 = EatMyShorts(foo+0.5*step, df,t, ncp);
      y3 = EatMyShorts(foo+step, df,t, ncp);
      P=P+step*(y1+y2*4+y3)/6; ## homer simpson's meffud!
      foo=foo+step;
    }
  L1*P
}


Pwr222 <- function (N, alpha, AccLimitLo, AccLimitHi, TRRatio, CV)
{
  df = N-2;
  tc = qt( 1-alpha, df);
  k  = sqrt(2/N);
  d1 = (log(TRRatio)-log(AccLimitLo))/(k * sqrt(log(1+CV*CV)));
  d2 = (log(TRRatio)-log(AccLimitHi))/(k * sqrt(log(1+CV*CV)));
  R  = sqrt(df) * (d1-d2) / (2*tc);
 
  P2 = Apfelstrudel(-tc, df, 0,R,d2, 300);
  P1 = Apfelstrudel(tc, df, 0,R,d1, 300);
  P2-P1
}

I_Eat_Cadmium <- function(P, TR, CV, alpha, N)
{

   AccLimLo = 0.9999;
   
   delta= 0.05;
   for (i in 1:20) ##change 20 here for fiddling with precision and time
    {
      AccLimHi=1/AccLimLo;   
      P0=P
      P1=Pwr222(N, alpha, AccLimLo, AccLimHi, TR, CV);
      while (P1<P0)
       {
        AccLimLo1=AccLimLo-delta;
        AccLimHi1=1/AccLimLo1;   
        P1=Pwr222(N, alpha, AccLimLo1, AccLimHi1, TR, CV)
        AccLimLo=AccLimLo-delta
       }
      if (P1>=P0) AccLimLo=AccLimLo1+delta else AccLimLo=AccLimLo1;
      delta=delta*0.4; ##change factor here for fiddling with precision and time       
               
    }
   cat("Acc Lim Lo: ", AccLimLo, "\n");
   cat("Acc Lim Hi: ", 1/AccLimLo, "\n");
}



Pwr222(30,0.05, 0.8, 1.25, 0.95, 0.3) is 0.6850399.

Let's check:
OK, what acceptance range matches a 2,2,2-design with T/R being 0.95, N=30 and power being 0.6850399?

I_Eat_Cadmium (0.6850399, 0.95, 0.3, 0.05, 30) gives the answer.

And if the CV is not 0.3 but 0.4 then which acc range can apply?
I_Eat_Cadmium (0.6850399, 0.95, 0.4, 0.05, 30)


Better approximation possible by this approach, no?


EM.

Complete thread:

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

If you shut your door to all errors
truth will be shut out.    Rabindranath Tagore

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