File size: 986 Bytes
6011a54 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | alternative = "two.sided")
## CALCULATE DETECTABLE MEAN DIFFERENCE IN CALVING SUCCESS
**mean_diff** = SD_within * power_test_results$d
## COMPARE DIFFERENCE IN MEANS TO NONSPONGER CALVING SUCCESS
percent_increase=mean_diff/mean_CS_nonspongers
## RETURN RESULTS
print("TWO-SIDED_TEST:\")
print(paste("Difference_inmeans: ", mean_diff, " _Percent_increase: ", 100*round(percent_increase, digits=2,"%)))
### PERFORM POWER ANALYSIS FOR A ONE-SIDED TEST
## RUN POWER ANALYSIS
power_test_results=pwr.t2n.test(nl=n_nonspongers, n2=n_spongers, d=NULL, sig.level = 0.05, power = 0.8,
alternative = "greater")
## CALCULATE DETECTABLE MEAN DIFFERENCE IN CALVING SUCCESS
**mean_diff** = SD_within * power_test_results$d
## COMPARE DIFFERENCE IN MEANS TO NONSPONGER CALVING SUCCESS
percent_increase=mean_diff/mean_CS_nonspongers
## RETURN RESULTS
print("ONE-SIDED_TEST:\")
print(paste("Difference_inmeans: ", mean_diff, " _Percent_increase: ", 100*round(percent_increase, digits=2),"%")) |