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),"%"))