tinv function giving wrong values

18 Ansichten (letzte 30 Tage)
Zhangxi Feng
Zhangxi Feng am 6 Feb. 2017
Kommentiert: Catherine Mauck am 15 Feb. 2022
I used tinv(0.95,16) and it returned 1.746, which is the value for 90% confidence interval at a df of 16. In order to get the correct value of 2.12 I would need to use 0.975 with df of 16.
Am I using it wrong or is the database wrong?

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 6 Feb. 2017
Are you sure?
>> tcdf(2.12,16)
ans =
0.975004535643448
>> tcdf(1.746,16)
ans =
0.950010376153097
The Maple software packages agrees with these.
  2 Kommentare
Zhangxi Feng
Zhangxi Feng am 6 Feb. 2017
Interesting. My textbook may be wrong!
Zhangxi Feng
Zhangxi Feng am 6 Feb. 2017
Bearbeitet: Zhangxi Feng am 6 Feb. 2017
I searched various sources and there seems to be a difference of opinions.
After some investigation, I think there is a misunderstanding of what it means by One-tail and two tail probabilities. Some sources list 0.975 and say one-tail is 0.025, two tails are 0.05. While sources like my textbook lists 0.95 and say one tail is 0.025, two tails are 0.05. Frankly, based on what I know about the English language, I feel it is more correct to have one tail 0.025, two tails 0.05, hence the area in between is 0.95.
Following links support my textbook: Excel's T.inv.2T function https://people.richland.edu/james/lecture/m170/tbl-t.html https://www.safaribooksonline.com/library/view/the-humongous-book/9781592578658/kell_9781101151396_oeb_bm1_r1.html

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Publius
Publius am 19 Feb. 2021
I know that this is a bit of an old post, but I've been stuck on this for a while, and wanted to be able to help someone else down the line. I noticed the same thing. My professor said that for the first number, we should enter (1-(1-conf/100)/2). For example, for a 95% confidence interval with 16 degrees of freedom,
tinv(1-(1-95/100)/2,16)
Of course this can be simplified to
tinv(1-(1-.95)/2,16)
This worked for me for all values of confidence interval to return the "expected" value that is in our notes. I'm really not familiar with the statistics behind this and other tails, but this was the thing that worked for me. Hope this helps someone else.
  1 Kommentar
Catherine Mauck
Catherine Mauck am 15 Feb. 2022
Thank you for this comment! I hope I can add some additional context to explain as well, for anybody who is not well-versed in stats. I am teaching really basic statistics for a specific, non-mathematical application (a lab science), and need students to be able to reproduce in MATLAB the act of looking up the corresponding t value in the textbook's table -- the problem was it didn't match, as pointed out above.
The values of t in the table that the textbook I teach from are two-tailed, which they define as meaning "95% confidence specifies the regions containing 2.5% of the area on either side of the curve extremes. For a one-tailed test, we would use values of t listed for 90% confidence, because each wing outside of t for 90% confidence contains 5% of the area of the curve."
So taking @Jacob Snider's workaround, the t value for a 2T test at 95% confidence (x = 0.95) would be produced like this:
dataArray = [3.29, 3.22, 3.30, 3.23];
df = numel(dataArray) - 1;
conf = @(x) 1 - (1 - x)/2;
t_crit = tinv(conf(0.95),df);
For the data above, this gives a critical t value of 3.182(4) which matches the 2T 95% t in my text's table.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by