tinv function giving wrong values
18 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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?
0 Kommentare
Akzeptierte Antwort
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
Weitere Antworten (1)
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
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.
Siehe auch
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!