0
$\begingroup$

I have a problem in calculating sample size. I did do a small pilot experiment, so this is some sample data with the same structure:

df <- data.frame(ID = c(1,2,3,4,5,6,7,8,9),
                 School = c("A","A","A","B","B","B","C","C","C"),
                 Test_Method_A = c("1A","2A","3A","1A","2A","3A","1A","2A","3A"),
                 SchoolSystemA_Score = c(80,75,25,87,65,15,66,90,65),
                 Test_Method_B = c("1B","2B","3B","1B","2B","3B","1B","2B","3B"),
                 SchoolSystemB_Score = c(78,56,80,58,65,98,79,55,70))
df
  ID School Test_Method_A SchoolSystemA_Score Test_Method_B SchoolSystemB_Score
1  1      A            1A                  80            1B                  78
2  2      A            2A                  75            2B                  56
3  3      A            3A                  25            3B                  80
4  4      B            1A                  87            1B                  58
5  5      B            2A                  65            2B                  65
6  6      B            3A                  15            3B                  98
7  7      C            1A                  66            1B                  79
8  8      C            2A                  90            2B                  55
9  9      C            3A                  65            3B                  70

The idea is this: I'm trying to compare 2 school systems. Based on different factors I have paired schools together. So for ID=1 you have 2 schools with either a school method A or school method B. 3 different types of measuring were done for each School. And because a school with method A requires different testing methods than a school with system B, I end up with 6 different measuring types. For each measurement account: a class is tested and the average score (in %) is used. In the end, I want to know which method gives higher grades, and the outcome should say something for all schools (with the same methods of course, compared to each other) in the USA

But to make a proposal I need to give an indication for the sample size, and I am very unsure about how to calculate this. So what I think I should at least know is the variance of the SchoolSystemA_Scoreand SchoolSystemB_Score, and the effect size I would at least want to know is 5%.

I'm just not really sure how I should split the groups (or shouldn't)

and what way to do this, is

pwr.t.test(d=d, sig.level=.05, power = .90, type = 'two.sample')

a good way to go?

Sorry this might be very obvious for many, but I've tried to find articles/literature on this but I get very stuck. mostly because I can;t seem to translate it to my dataset.. Could anyone help me with this, very much appreciated!

$\endgroup$

closed as unclear what you're asking by StatsStudent, Michael Chernick, kjetil b halvorsen, mdewey, Carl Jan 10 at 9:51

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ What do you mean by 3 different types of measuring were done for each school? Do you mean for school A, three measurements (i.e. 3 replicates) were taken on your subject of interest and the same for it's matched school B? Or do you really mean that three different types of measurements were taken (perhaps on 3 different variables of interest)? I also see a school C listed in your data, but not mentioned anywhere in your text? Was a third school measured somehow? $\endgroup$ – StatsStudent Jan 8 at 15:47
  • $\begingroup$ @StatsStudent thank you for your response! So yes it's what you said: three different types of measurements were taken on 3 different variables of interest. And the School variable are different schools. Sorry I was trying to make simplify it. So Let's change it to medicins: You have a Person (=Variable School) with 3 different tests (=variable Test_Method) he/she is tested for blood sugar before taking the medicine that gives a score for every different test (= variable SchoolSystemA_Score). Then, the same person takes a medicine that should influence bloodsugar level. >> $\endgroup$ – Lotw Jan 9 at 7:10
  • $\begingroup$ @StatsStudent >>Because of the type of medicine, the blood sugar after the medicine can only be measured with different types of tests, so you get 3 new test methods (=variable Test_Method_B) and this again gives 3 different scores (SchoolSystemB_Score). Hope this gives a better idea of my data..! The only difference here is that, now I talk about person but actually what I have are groups of people that do 3 tests and for each test only 1 % outcome $\endgroup$ – Lotw Jan 9 at 7:11
  • $\begingroup$ Now that I had to write it down I, I think I'm looking for a way to calculate sample size for paired wilcoxon signed rank test (as my pilot data is also non-parametric)? $\endgroup$ – Lotw Jan 9 at 7:36