# [ncl-talk] Problem using ttest function

Adam Phillips asphilli at ucar.edu
Tue Jan 22 11:39:49 MST 2019

```Hi Anne,
I think Rashed and Dennis are both correct, you do want
100*(1-ttest_values) in your formula. Looking at your plot with that
perspective (as in, values <=5 are significant to the 95% level), the
contours make much more sense.

On Mon, Jan 21, 2019 at 8:06 PM Dennis Shea <shea at ucar.edu> wrote:

> I have not looked at this in ge=reat detail.
> However, *maybe*, the attached schemattic is the approach to use.
>
> Good Luck
>
> On Mon, Jan 21, 2019 at 5:08 PM Rashed Mahmood <rashidcomsis at gmail.com>
> wrote:
>
>> I think the line for prob should be as below (Note 1-ttest):
>>
>>  prob =  100.*(*1-*ttest(ave_s, VAR_s, xN, ave_c, VAR_c, yN, iflag,
>> tval_opt))
>>
>> Not sure if this would solve the issue, but thought it might help?
>>
>> Cheers,
>> Rashed
>>
>>
>>
>>
>> On Mon, Jan 21, 2019 at 7:52 AM Anne <anne.seidenglanz at unive.it> wrote:
>>
>>>
>>> thanks for your suggestion; indeed I suspected there could be issues
>>> with the choice of xN and yN. In fact I have played with these numbers, but
>>> unfortunately even setting them to 10 does not change much (see attached
>>> plot). In any case I agree that 10 ensemble members is not a high number
>>> for ensemble statistics. Do you think the strange probability pattern in
>>> the plot could be due to this fact?
>>>
>>> thanks,
>>> Anne
>>>
>>> On Fri, Jan 18, 2019 at 8:12 PM Adam Phillips <asphilli at ucar.edu> wrote:
>>>
>>>> Hi Anne,
>>>> You are calling equiv_sample_size (which we usually recommend), and
>>>> then your are calling wgt_areaave to arrive at one number:
>>>>   xEqv = equiv_sample_size (jfm_s, sigr, 0)
>>>>   yEqv = equiv_sample_size (jfm_c, sigr, 0)
>>>>   xN   = wgt_areaave (xEqv, 1., 1., 0)    ; wgty could be gaussian
>>>> weights
>>>>   yN   = wgt_areaave (yEqv, 1., 1., 0)
>>>>           prob =  100.*(ttest(ave_s, VAR_s, xN, ave_c, VAR_c, yN,
>>>> iflag, tval_opt))
>>>>
>>>> To simplify things you could replace xN and yN with 10 (=the number of
>>>> ensemble members, or sample size). But note: Depending on the field you are
>>>> looking at 10 samples is not a large number, especially if there is high
>>>> autocorrelation. This also might result in values coming out of
>>>> equiv_sample_size = 1 or 0, which might cause issues in the ttest function.
>>>>
>>>> Hope that helps. If you have further questions let ncl-talk know.
>>>>
>>>> On Thu, Jan 17, 2019 at 2:14 PM Anne <anne.seidenglanz at unive.it> wrote:
>>>>
>>>>> Hi everyone,
>>>>>
>>>>> I have some issues using the built-in 'ttest' function. When I plot
>>>>> the 'raw' probability (so regardless of any significance level), I end up
>>>>> with a rather strange plot, see attached.
>>>>> I followed example 4 from the documentation at
>>>>> https://www.ncl.ucar.edu/Document/Functions/Built-in/ttest.shtml,
>>>>> just that instead of time I have ensemble member as the right-most
>>>>> dimension, and hence compute mean and variance of the ensemble members. So
>>>>> my two fields each have the following dimensions:
>>>>> Dimensions and sizes: [Ens | 10] x [lat | 180] x [lon | 360]
>>>>>
>>>>> Fields for mean and variance look fine, but there is something wrong
>>>>> with the probability plot. I attach also the script.
>>>>>
>>>>> Thanks for any advice,
>>>>> Anne
>>>>>
>>>>> Nota automatica aggiunta dal sistema di posta.
>>>>> _______________________________________________
>>>>> ncl-talk mailing list
>>>>> ncl-talk at ucar.edu
>>>>> List instructions, subscriber options, unsubscribe:
>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>
>>>>
>>>>
>>>> --
>>>> Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
>>>> www.cgd.ucar.edu/staff/asphilli/   303-497-1726
>>>>
>>>> <http://www.cgd.ucar.edu/staff/asphilli>
>>>>
>>>
>>> Nota automatica aggiunta dal sistema di posta.
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at ucar.edu
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>

--