BE-proff ● 2017-07-20 16:09 (2443 d 07:33 ago) Posting: # 17577 Views: 8,730 |
|
Hi All, I need to calculate sample sizes providing CV=0.26 and ratio varying from 0.85 to 1.20 with step 0,05. How to make a script in R which returns a table with results? Thank you Edit: Category changed. [Helmut] |
ElMaestro ★★★ Denmark, 2017-07-20 16:32 (2443 d 07:11 ago) @ BE-proff Posting: # 17578 Views: 7,986 |
|
Hi BE-proff, try this: library(PowerTOST) you can easily put it inside a little function if the purpose is specifcally to "return" the data frame (as in, a table). You can make the code totally fancier and totally unreadable by using sapply or some similar function - I am sure this is what the code police recommends.— Pass or fail! ElMaestro |
BE-proff ● 2017-07-20 17:02 (2443 d 06:41 ago) @ ElMaestro Posting: # 17579 Views: 7,943 |
|
Hi ElMaestro, Many thanks for the code but I am just user of scripts So that recommendations like "insert" or "use function" are not for me But you are right - the purpose is to make a table with results |
Helmut ★★★ Vienna, Austria, 2017-07-20 17:18 (2443 d 06:24 ago) @ BE-proff Posting: # 17580 Views: 8,017 |
|
Hi BE-proff, try this (for 80 and 90% target power):
Try this:
— Dif-tor heh smusma 🖖🏼 Довге життя Україна! Helmut Schütz The quality of responses received is directly proportional to the quality of the question asked. 🚮 Science Quotes |
BE-proff ● 2017-07-20 18:00 (2443 d 05:43 ago) @ Helmut Posting: # 17582 Views: 7,861 |
|
Hi Helmut, No, I didn't catch an idea. Do you think that absence of symmetry critical? |
Helmut ★★★ Vienna, Austria, 2017-07-20 19:12 (2443 d 04:31 ago) @ BE-proff Posting: # 17583 Views: 8,190 |
|
Hi BE-proff, ❝ No, I didn't catch an idea. ❝ Do you think that absence of symmetry critical? Power curves are asymmetrical around 1 in linear scale (as is the acceptance range) but symmetrical around 0 in logarithmic scale (AR: ±0.2231). Try this (CV 0.26, GMR 0.9, n 60 for target power 80%):
Press or click in the graphics window to go to the next plot. To switch between plots navigate to the graphics window and use / to switch plots. The power curve is positively skewed. For any –∆ you get the same power at 1/∆. In the example: For GMR 1.1111 as for GMR 0.90 since 1/0.90 = 1.1111. In many protocols I read “planned for a T/R-ratio of 0.90 to 1.10”. Nope. If the sample size estimation was done for 0.90 it covers anything up to 1.1111. Or the other way ’round: If it was done for 1.10 it would cover anything down to only 1/1.1 = 0.9091 (and not 0.90). Hence, the latter is stupid – unless you know (!) that the GMR will be >1. If you don’t know the sign of ∆, always plan for a GMR <1 and you will be on the safe side. The second part of the script demonstrates that in log-scale (where the entire analysis is done) everything is symmetrical indeed: Hope that helps. — Dif-tor heh smusma 🖖🏼 Довге життя Україна! Helmut Schütz The quality of responses received is directly proportional to the quality of the question asked. 🚮 Science Quotes |
BE-proff ● 2017-07-24 13:42 (2439 d 10:01 ago) @ Helmut Posting: # 17599 Views: 7,761 |
|
Hi Helmut, Many thanks for clarification! Could you please tell how to add study design to library(PowerTOST) |
Helmut ★★★ Vienna, Austria, 2017-07-24 20:18 (2439 d 03:25 ago) @ BE-proff Posting: # 17600 Views: 7,739 |
|
Hi BE-proff, no need to copypaste my entire code. ❝ Could you please tell how to add study design to Please do your homework and RTFM:
Add the design-string (as provided in second column of known.designs() ) as an argument to sampleN.TOST(...) in the two lines starting with x1 <- and x2 <- Easy. — Dif-tor heh smusma 🖖🏼 Довге життя Україна! Helmut Schütz The quality of responses received is directly proportional to the quality of the question asked. 🚮 Science Quotes |