tinv function giving wrong values

18 ビュー (過去 30 日間)
Zhangxi Feng
Zhangxi Feng 2017 年 2 月 6 日
コメント済み: Catherine Mauck 2022 年 2 月 15 日
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?

採用された回答

Walter Roberson
Walter Roberson 2017 年 2 月 6 日
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 件のコメント
Zhangxi Feng
Zhangxi Feng 2017 年 2 月 6 日
Interesting. My textbook may be wrong!
Zhangxi Feng
Zhangxi Feng 2017 年 2 月 6 日
編集済み: Zhangxi Feng 2017 年 2 月 6 日
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

サインインしてコメントする。

その他の回答 (1 件)

Publius
Publius 2021 年 2 月 19 日
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 件のコメント
Catherine Mauck
Catherine Mauck 2022 年 2 月 15 日
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.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by