Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Highlighted

09-16-2020 12:33 PM

Options

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

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 CDF.vi", 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?

Solved! Go to Solution.

Highlighted
Options

09-17-2020 05:30 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

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.

Saved for LV14

Highlighted
Options

09-18-2020 09:24 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

*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?

Highlighted
Options

Solution

Accepted by topic author jrdwight

09-18-2020 12:29 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

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.

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

09-18-2020 02:23 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Highlighted
Options

09-18-2020 03:14 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

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?

Highlighted
Options

Solution

Accepted by topic author jrdwight

09-18-2020 03:47 PM - edited 09-18-2020 03:49 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

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.

Highlighted
Options

09-18-2020 04:21 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

That worked! Thanks again.