Okay I will explain. Yes, simp_p() routine calculates the integral of the equation found in the equation routine.
Basically, I first wrote the simp_p() routine because, given a cutoff value (obtained from a table on the percentile values for the chi-squared distribution), I am able to calculate...
Oh, and for the amount my answer is off...
SUPPOSED TO BE: 11.4, getting 11.8
supposed to be: 12.6, getting 12.5
supposed to be 10.2, getting 11.0
So I figured out what is happening. I have been giving it a cutoff point (the value I'm starting with for B...) and every time I'm getting roughly...
1. I will try this.
2. Yes it does return a value of 0, but then I subtract p from it which gives a negative p value. When doing method of bisection, you check the value of the function at each endpoint. My function subtracts p outside of the integral, so p doesn't get subtracted in the simp_p...
I am trying to write a program that calculates the root of chi-square. I am not getting the correct answer and I honestly am at my wits end trying to figure it out. I know my simp_p() method is returning the correct value, but for some reason my root_chisq() method is not giving me the correct...