BE-proff
●    

2015-08-10 11:07
(3153 d 00:48 ago)

Posting: # 15206
Views: 17,355
 

 Comparison of normality tests [🇷 for BE/BA]

Hi All,

Quite interesting article about comparison of normality tests is available at https://noppa.aalto.fi/noppa/kurssi/becs-114.5501/materiaali/Becs-114_5501_normality_tests_comparison.pdf

But one thing worries: the article concludes that all tests are rather weak if sample size is below 30. :-(

What to think about BE-studies with samples 18, 24? :confused:


Edit: Category changed from General statistics. Since the second reply I think that this category fits better. [Helmut]
Helmut
★★★
avatar
Homepage
Vienna, Austria,
2015-08-11 03:21
(3152 d 08:34 ago)

@ BE-proff
Posting: # 15218
Views: 16,171
 

 To test or not to test…

Hi BE-proff,

interesting paper. So I stick with Shapiro-Wilk for my home brewed stuff.

❝ But one thing worries: the article concludes that all tests are rather weak if sample size is below 30. :-(

❝ What to think about BE-studies with samples 18, 24? :confused:


Don’t test for normality. The multiplicative model we are using in BE is based on
  • The basic equation of PK:
      AUC = FD/CL,
    which can be linearized by taking the logarithms to
      ln(AUC) = ln(F) + ln(D) – ln(CL).
    Now we can apply an ANOVA, which requires additive effects.
    OK, we are interested in comparing the Fs of product (assuming equal doses and clearances). So,
      BA = AUCT/AUCR or ln(BA) = ln(AUCT) – ln(AUCR). Nice.
  • Multiplicative errors in bioanalytics due to serial dilution of stock / spiking solutions.
Have a look at this example (slides 4–6): Pooled AUC-data of 437 subjects. Shapiro-Wilk rejects the norm­ality assumption for raw data with p 1.35·10–14 (‼), but not for ln(AUC) with p 0.293. In the next slide we have one of the studies (n=12). The norm­ality assumption is neither rejected for AUC nor for ln(AUC). The former p-value is smaller than the latter, but still n.s. Normality tests are not built to decide between two distributions. That’s not their job, but ours.

Nitpicking:
  • Strictly speaking the distribution of PK metrics is irrelevant (as long as they are identical). In the BE-context only the within-subject residuals of the model should be normal. It might well be that residuals of two extremely skewed (not normal, but identical) distributions still give nomal residuals.
  • If these residuals are not normal, one could opt for a nonparametric method. Well, cough…
How is your R-learning curve doing? Try this:

x1 <- rweibull(40, 1, 1) # Weibull distribution
x2 <- rweibull(40, 1, 1)
d  <- x1-x2
op <- par(no.readonly=T)
par(mfrow=c(3, 1))
hist(x1, freq=F, xlim=c(0, 8), xlab="", las=1, main="x1")
legend("topright", bty="n",
  legend=paste("p =", signif(shapiro.test(x1)$p.value, 3)))
hist(x2, freq=F, xlim=c(0, 8), xlab="", las=1, main="x2")
legend("topright", bty="n",
  legend=paste("p =", signif(shapiro.test(x2)$p.value, 3)))
hist(d, freq=F, xlim=c(-6, 6), xlab="", las=1, main="x1 \u2012 x2")
legend("topright", bty="n",
  legend=paste("p =", signif(shapiro.test(d)$p.value, 3)))
par(op)


Dif-tor heh smusma 🖖🏼 Довге життя Україна! [image]
Helmut Schütz
[image]

The quality of responses received is directly proportional to the quality of the question asked. 🚮
Science Quotes
BE-proff
●    

2015-08-11 12:06
(3151 d 23:48 ago)

@ Helmut
Posting: # 15224
Views: 15,920
 

 To test or not to test…

Hi Helmut,

Many thanks for reply.

My progress with R has pended because R-console doesn't want to see TOST library :angry: Maybe R doesn't work with Windows 8?

BTW is there a "support" where I could place a screenshot with the error? ;-)
Helmut
★★★
avatar
Homepage
Vienna, Austria,
2015-08-11 14:07
(3151 d 21:47 ago)

@ BE-proff
Posting: # 15225
Views: 16,094
 

 R packages/libraries

Hi BE-proff,

❝ […] R-console doesn't want to see TOST library :angry:


Define “doesn’t want”. ;-)

❝ Maybe R doesn't work with Windows 8?


Oh, it does. AFAIK, Detlew developed the latest version under Win8.

Try this:
  • Type (.packages())
    If PowerTOST is not in the list, you either have not loaded it or it is not available at all.
  • Type library()
    A new window opens showing all installed packages. If PowerTOST is not in the list you need to download/install it first (see here).
  • If it is in the list, type library(PowerTOST)
  • If you get an error, post the text here. Screenshots are sometimes difficult to read – or does R crash?
  • If loading works, check this: sampleN.TOST(CV=0.3)
    Should give at the end n=40 and power=0.815845.

❝ BTW is there a "support" where I could place a screenshot with the error? ;-)


Nope, there is no “support” in R. Generally you could ask the maintainer(s) of packages. You find the contact e-mail(s) in the DESCRIPTION-file. Type packageDescription("foo"), where foo is he name of the library.


PS: Sometimes we forget to post the required libraries here. Without library(PowerTOST) in the current R-session – if you copy/paste sampleN.TOST(CV=0.3) – R will tell you:
Error: could not find function "sampleN.TOST"
In my posts (containing multiple code sections) I start with library(foo) on top. Of course, if someone tries only a later part, an error will be thrown. I will change my habits and start all sections with library(foo).

PPS: For the code posted above you don’t need to load anything.

Dif-tor heh smusma 🖖🏼 Довге життя Україна! [image]
Helmut Schütz
[image]

The quality of responses received is directly proportional to the quality of the question asked. 🚮
Science Quotes
BE-proff
●    

2015-08-11 14:29
(3151 d 21:26 ago)

@ Helmut
Posting: # 15226
Views: 15,980
 

 R packages/libraries

Dear Helmut,

Thank you for comprehensive instructions ) I will torture R again today :-)

Regarding screenshots - do you work with Gyazo links?
Helmut
★★★
avatar
Homepage
Vienna, Austria,
2015-08-11 15:18
(3151 d 20:37 ago)

@ BE-proff
Posting: # 15228
Views: 15,990
 

 R packages/libraries

Hi BE-proff,

❝ I will torture R again today :-)


Good luck!

❝ Regarding screenshots - do you work with Gyazo links?


Nope. If you uploaded one, you could post the URL here. If the width of the screenshot is larger than ~720px I recommend to post a link (see here) instead of using the img-BBCode – other­wise it will screw up the layout of the post.

Dif-tor heh smusma 🖖🏼 Довге життя Україна! [image]
Helmut Schütz
[image]

The quality of responses received is directly proportional to the quality of the question asked. 🚮
Science Quotes
BE-proff
●    

2015-08-12 00:15
(3151 d 11:40 ago)

@ Helmut
Posting: # 15236
Views: 16,006
 

 R packages/libraries

Dear Helmut,

This evening is not kind to me :crying:

I entered library () and PowerTOST was shown in the list. But command library (PowerTOST) returns:

Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
there is no package called ‘mvtnorm’
Error: package or namespace load failed for ‘PowerTOST’


What could it mean?:confused:
Helmut
★★★
avatar
Homepage
Vienna, Austria,
2015-08-12 00:28
(3151 d 11:27 ago)

@ BE-proff
Posting: # 15237
Views: 16,112
 

 R packages/libraries

Hi BE-proff,

package mvtnorm is required by PowerTOST to access the noncentral t-distribution. I always thought that dependent libraries are downloaded automatically. Suggestion: Close R, start it again, and download / install mvtnorm from your preferred mirror. Then try library(PowerTOST) again.

Dif-tor heh smusma 🖖🏼 Довге життя Україна! [image]
Helmut Schütz
[image]

The quality of responses received is directly proportional to the quality of the question asked. 🚮
Science Quotes
BE-proff
●    

2015-08-12 00:39
(3151 d 11:15 ago)

@ Helmut
Posting: # 15238
Views: 15,903
 

 R packages/libraries

Hi Helmut,

It it getting really interesting :-D

I have installed missed mvtnorm package and now R says:

Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : object 'vI' not found
Error: package or namespace load failed for ‘PowerTOST’
d_labes
★★★

Berlin, Germany,
2015-08-12 11:07
(3151 d 00:48 ago)

@ BE-proff
Posting: # 15240
Views: 16,680
 

 R packages/libraries

Dear BE-proff, dear Helmut,

❝ It it getting really interesting :-D


❝ I have installed missed mvtnorm package and now R says:


Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : object 'vI' not found

Error: package or namespace load failed for ‘PowerTOST’


That all is very mysterious to me :confused:!
I always got packages including all dependencies. And they worked out of the box. How do you install packages? Via menu within Rgui.exe? Or via install.packages()? Any errors during installation?

After Goggling a while I think this link Number 7 may be a hint to the reason:
The user which you use to install packages must have write permissions to the location where the package will be saved on your drive(s). Usually this is "c:\Program Files\R\R-3.2.1\library\" if you haven't set it to other. And 'ordinary' users don't have write permissions there.

You may query the path by
.libPaths()
Then check if the directories PowerTOST and/or mvtnorm look like the other packages of the base install.

BTW: It may be a good idea to have the packages not in base installation separated. I have a directory "c:\Program Files\R\library\" for that :cool:.
To work with this setting you have to create under "c:\Program Files\R\R-3.2.1\etc\" a file named Renviron.site with the content
R_LIBS="C:/Program Files/R/library"
But beware also your write permissions in that location.

Hope this helps.

Regards,

Detlew
BE-proff
●    

2015-08-12 12:36
(3150 d 23:19 ago)

@ d_labes
Posting: # 15241
Views: 15,871
 

 R packages/libraries

Dear Detlew,

I installed packages via Menu option - installation from local zip-file. Package was installed without any errors.

Maybe this way was incorrect?

As I am not strong user how to write relevant permissions?

Thank you in advance!

P.S. I will also try to install package on a netbook with Win 7:-)
This Win has less problems with users and permissons )
d_labes
★★★

Berlin, Germany,
2015-08-12 13:13
(3150 d 22:42 ago)

@ BE-proff
Posting: # 15243
Views: 15,878
 

 R packages/libraries install

Dear BE-proff,

❝ I installed packages via Menu option - installation from local zip-file. Package was installed without any errors.


Ok, then dependencies are not automatically resolved, I think.
Use menu packages/install package(s) to install from CRAN directly (without download of any *.zip) and to resolve also the dependencies.
Or type in the console
install.packages("PowerTOST", dependencies=TRUE).

What puzzles me a little bit is "installed without any errors". Really?

❝ As I am not strong user how to write relevant permissions?


Simplest: Log-on as administrator, if you are allowed, and then install package(s).
Second simplest: Ask a good friend with Windoof's (doof=stupid) skills or ask your administrator :cool:.
Little bit harder: Consult Windows forums. This here is not such one.

Regards,

Detlew
yjlee168
★★★
avatar
Homepage
Kaohsiung, Taiwan,
2015-08-12 13:43
(3150 d 22:12 ago)

@ d_labes
Posting: # 15244
Views: 15,883
 

 install package(s) from a local zip file?

Dear Detlew,

install.packages("PowerTOST", dependencies=TRUE).


Exactly correct.

❝ What puzzles me a little bit is "installed without any errors". Really?


Apparently, he downloaded the zip file of PowerTOST (as well as mvtnorm) from CRAN repository site first. And then install PowerTOST (and mvtnorm) from 'install package from a local zip file...'. In this case, there would not have any error at all. It looks like that the package mvtnorm need to import methods from its DESCRIPTION file. So he also needs to install the package methods using install.packages("methods"), if not to re-install PowerTOST as you suggest.

All the best,
-- Yung-jin Lee
bear v2.9.1:- created by Hsin-ya Lee & Yung-jin Lee
Kaohsiung, Taiwan https://www.pkpd168.com/bear
Download link (updated) -> here
BE-proff
●    

2015-08-12 14:06
(3150 d 21:49 ago)

@ yjlee168
Posting: # 15246
Views: 15,718
 

 install package(s) from a local zip file?

Hi Yung-jin Lee,

:surprised: I wish I were a programmer...
I will try to follow your tip

Thanks
d_labes
★★★

Berlin, Germany,
2015-08-12 15:02
(3150 d 20:53 ago)

@ yjlee168
Posting: # 15248
Views: 15,793
 

 install package(s)

Dear Yung-jin,

❝ ... It looks like that the package mvtnorm need to import methods from its DESCRIPTION file. So he also needs to install the package methods ...


Package methods is usually contained in the base installation, I think.

Regards,

Detlew
Helmut
★★★
avatar
Homepage
Vienna, Austria,
2015-08-12 15:13
(3150 d 20:42 ago)

@ d_labes
Posting: # 15249
Views: 16,025
 

 Packages attached by default

Dear Detlew & Yung-jin,

❝ Package methods is usually contained in the base installation, I think.


Correct. After starting R and cat(sort((.packages())), "\n") I got:

base datasets graphics grDevices methods stats utils


Dif-tor heh smusma 🖖🏼 Довге життя Україна! [image]
Helmut Schütz
[image]

The quality of responses received is directly proportional to the quality of the question asked. 🚮
Science Quotes
yjlee168
★★★
avatar
Homepage
Kaohsiung, Taiwan,
2015-08-12 16:58
(3150 d 18:57 ago)

@ d_labes
Posting: # 15250
Views: 15,692
 

 install package(s)

Dear Detlew and Helmut,

Yes, I was wrong about missing package methods. Is it possible because of missing another package crossdes required by PowerTOST?
[edited] I just deleted the package crossdes from ../library, it seemed still OK to load PowerTOST. Failed to reproduce the error as described.:confused:

❝ Package methods is usually contained in the base installation, I think.


All the best,
-- Yung-jin Lee
bear v2.9.1:- created by Hsin-ya Lee & Yung-jin Lee
Kaohsiung, Taiwan https://www.pkpd168.com/bear
Download link (updated) -> here
d_labes
★★★

Berlin, Germany,
2015-08-12 18:33
(3150 d 17:21 ago)

@ yjlee168
Posting: # 15251
Views: 15,856
 

 suggested package(s)

Dear Yung-jin,

Package crossdes is only named under suggest in the DESCRIPTION file of PowerTOST. That means it is not necessary for the correct functioning of PowerTOST. It's only necessary for some examples. Don't ask me which :-D.

Regards,

Detlew
BE-proff
●    

2015-08-12 13:57
(3150 d 21:57 ago)

@ d_labes
Posting: # 15245
Views: 15,770
 

 R packages/libraries install

Dear Detlew,

❝ What puzzles me a little bit is "installed without any errors". Really?


Really ;-)

I will try to install it today )
BE-proff
●    

2015-08-12 20:26
(3150 d 15:29 ago)

@ BE-proff
Posting: # 15252
Views: 15,779
 

 I don't believe!!!

Dear All,

I don't believe but it looks like I have managed to install TOST! :party:
At least several codes placed by Helmut really work.

Thanks to everyone to their tips and patience! :ok:
d_labes
★★★

Berlin, Germany,
2015-08-13 10:36
(3150 d 01:18 ago)

@ BE-proff
Posting: # 15253
Views: 15,371
 

 Congratulation

Dear BE-proff,

That's a great step toward your name suffix ;-).
Enjoy the big, wide world of power/sample size estimation possibilities in PowerTOST.

Regards,

Detlew
UA Flag
Activity
 Admin contact
22,957 posts in 4,819 threads, 1,639 registered users;
78 visitors (0 registered, 78 guests [including 6 identified bots]).
Forum time: 10:55 CET (Europe/Vienna)

Nothing shows a lack of mathematical education more
than an overly precise calculation.    Carl Friedrich Gauß

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