MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Student's T Confidence Interval [StudentTCI]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg111376] Re: Student's T Confidence Interval [StudentTCI]
  • From: Barrie Stokes <Barrie.Stokes at newcastle.edu.au>
  • Date: Thu, 29 Jul 2010 06:44:35 -0400 (EDT)

Hi David:

In[1]:= Needs["HypothesisTesting`"]

In[2]:= StudentTCI[\[Mu], \[Sigma] , df, ConfidenceLevel -> .975]

Out[2]= {\[Mu] - Sqrt[
   df] \[Sigma] Sqrt[-1 + 1/
    InverseBetaRegularized[1, -0.975, df/2, 1/2]], \[Mu] + 
  Sqrt[df] \[Sigma] Sqrt[-1 + 1/InverseBetaRegularized[1, -0.975, df/2, 1/2]]}

In[18]:= \[Mu] = 12
\[Sigma] = 21/Sqrt[10] // N
df = 10 - 1
StudentTCI[\[Mu], \[Sigma] , df, ConfidenceLevel -> .95]

Out[18]= 12

Out[19]= 6.64078

Out[20]= 9

Out[21]= {-3.0225, 27.0225}

You say:
So my confidence interval should be 12 + /- 2.262 (0.0664) = -3.0215 to 27.0215.
But I find:

In[16]:= {12 - 2.262 0.0664, 12 + 2.262 0.0664}

Out[16]= {11.8498, 12.1502}

But, the 0.0664 you used is not 21/Sqrt[10]:

In[17]:= {12 - 2.262 6.640783086353597`, 12 + 2.262 6.640783086353597`}

Out[17]= {-3.02145, 27.0215}

This agrees near enough with the StudentTCI result.

If you use:

In[23]:= Quantile[ StudentTDistribution[  9 ],  0.975]

Out[23]= 2.26216

You indeed get:

In[25]:= {12 - 
  Quantile[ StudentTDistribution[  9 ],  0.975] 6.640783086353597`, 
 12 + Quantile[ StudentTDistribution[  9 ],  0.975] 6.640783086353597`}

Out[25]= {-3.0225, 27.0225}

Cheers

Barrie

>>> On 28/07/2010 at 4:55 pm, in message <201007280655.CAA08255 at smc.vnet.net>,
davef <davidfrick2003 at yahoo.com> wrote:
> I don't understqnd how this function is working.
> 
> I have a sampe mean of 12, standard deviation of 21, sample size of 10
> and level of significance of .05.
> 
> The t critical value I get from a table for a 2-tail test (p=.
> 05/2=0.025 and df=10-1=9) is 2.262
> 
> My standard error of the estimate is std dev divided by square root of
> n = 21/(10)^1/2 = 0.0664.
> 
> So my confidence interval should be 12 +/- 2.262(0.0664) = -3.0215 to
> 27.0215
> 
> But in Mathematica this...:
> 
> \[Mu] = 12
> \[Sigma] = 21
> df = 10 - 1
> StudentTCI[\[Mu], \[Sigma] , df, ConfidenceLevel -> .975]
> 
> ...gives me this...
> 
> {-44.3852, 68.3852}
> 
> ...and this...
> StudentTCI[\[Mu], \[Sigma] , df, ConfidenceLevel -> .95]
> 
> ...gives me this...
> 
> {-35.5053, 59.5053}
> 
> What don't I undersatnd about how to use the StudentTCI function?



  • Prev by Date: Re: Forcing Mathematica to use standard fonts
  • Next by Date: Re: FindRoot with NDSolve inside of it doesn't work
  • Previous by thread: Re: Student's T Confidence Interval [StudentTCI]
  • Next by thread: modifying standard representation of DiracDelta