I want to plot a power function in R. The definition of the power function that is general to the sign test is: alpha if the pvalue > 0.05 and 1 otherwise.
The Code I have is:
# Power function do sign test
condition <- ifelse(results_df$sign_test_p_value>0.05,0.05,1)
plot(condition,type="l", main="Power Function",lwd=2,xlab= "Mean",ylab="Power of the test", xlim=c(9,15),ylim=c(0,1))
lines(condition_1, col='black',type="l", lty=2)
When I plot, the x axis starts in 12 and goes to 16. The problem here is that the x axis gives the values of the true mean. And the mean sample value is something around -0.00004. The problem here is that the values on x axis are not correct. I don't know if is something wrong with my code/ the way I did the plot.
If someone wants to check the code, the p values for the sign test are:
results_df <- data.frame(sign_test_p_value =
c(1.000000e+00, 1.000000e+00, 1.000000e+00,
1.000000e+00, 1.000000e+00, 1.000000e+00,
1.000000e+00, 1.000000e+00, 1.000000e+00,
9.964203e-01, 5.628114e-01, 1.046356e-02,
2.184458e-06, 6.853518e-12, 1.110223e-16,
1.110223e-16, 1.110223e-16, 1.110223e-16,
1.110223e-16, 1.110223e-16, 1.110223e-16))