From 12:00 AM CDT Sunday, October 17 - 11:30 AM CDT Sunday, October 17, will be undergoing system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.


Showing results for 
Search instead for 
Did you mean: 

Inverse CDF for noncentral t distribution

Go to solution

I'd like to create a VI that calculates the confidence interval for the p-th percentile of a normally distributed variable using the Lawless method, as described here. This requires computing the inverse cumulative distribution function (CDF) for a noncentral t distribution.


I'm familiar with the "Continuous Inverse", but there's no option for a noncentral t distribution in that VI.


Is there a way to compute the inverse CDF for a noncentral t distribution in LabVIEW?

0 Kudos
Message 1 of 8

Wikipedia or a good applied statistics book has the series you need for the CDF.  Instead of brute-forcing it I factored the components so that each term in the series can be found from the previous value.  Matches the central distribution when delta = 0 and gives me 10+ digit matches for the values I checked by hand.  Double check for bugs since I just kind of tossed this together.


Noncentral t-Distribution_CDF_FP.png


Saved for LV14

Message 2 of 8

Thanks Darin. I'm actually looking to compute the inverse CDF - i.e. the p-value is my input and the noncentral t-value is my output. It doesn't look like there's a nice analytical formula, so would I have to just use a lookup table after generating a bunch of data from the CDF?

0 Kudos
Message 3 of 8
Accepted by topic author jrdwight

I knew that when I started and then forgot when I finished the CDF VI.  If you are using the same parameters (delta, DOF) it may be worthwhile to create a lookup table and interpolate.  What I normally do is use a root finding routine, and I find Ridder's to be a good choice in situations where I am approximating the function.


I have attached a wrapper so the CDF function can be called from the built-in root finder VI, and a VI which brackets the desired value and then calls the root finder to locate the inverse.

Message 4 of 8

This is perfect! I'd started creating a lookup table, but this is much more efficient. Thank you so much!

0 Kudos
Message 5 of 8

Sorry, one problem I just noticed: it seems to run indefinitely for negative values of delta (noncentrality parameter). I tried making the "max error" something much smaller, like 1E-03, but it still runs indefinitely. (Granted, I've only waited maybe 15-20 seconds.)


Any idea what might be causing this? Is there a property of the noncentral t-distribution that would let me calculate the t-value at a positive gamma, then convert the t-value to the corresponding negative gamma value?

0 Kudos
Message 6 of 8
Accepted by topic author jrdwight

My bad, you need to feed abs(delta) into the Upper Bound and Lower Bound While loops instead of delta.   I use delta as sort of a natural step size when finding the bounds.


I'll post a picture if you need it.  Just insert the Abs(x) node into the branch that feeds the two while loops.

0 Kudos
Message 7 of 8

That worked! Thanks again.

0 Kudos
Message 8 of 8