[ncl-talk] Bootstrapping method for significant test

Dennis Shea shea at ucar.edu
Thu Dec 15 16:37:34 MST 2016


[1]
Sorry, bad wording: not 'wrong'. I did not look at the code carefully enough

[2]
Bootstrapping is  an alternative to using some classic parametric model as
a base reference.
It only uses the data at hand. It does not depend on any base distrbution.
The methof creates the distribution.
   http://www.ncl.ucar.edu/Applications/bootstrap.shtml
Once the 'nBoot' samples are generated, they are sorted into ascending
order.

   ia = *dim_pqsort_n*
<http://www.ncl.ucar.edu/Document/Functions/Built-in/dim_pqsort_n.shtml>(xBoot,
2, 0)        ; sort bootstrap means into ascending order

   n025     = *round*
<http://www.ncl.ucar.edu/Document/Functions/Built-in/round.shtml>(0.025*(nBoot-1),3)
   ; indices for sorted array
   n500     = *round*
<http://www.ncl.ucar.edu/Document/Functions/Built-in/round.shtml>(0.500*(nBoot-1),3)
   n975     = *round*
<http://www.ncl.ucar.edu/Document/Functions/Built-in/round.shtml>(0.975*(nBoot-1),3)

   xBoot_025= xBoot(n025)                 ;  2.5% level
   xBoot_500= xBoot(n500)                 ; 50.0% level  (median)
   xBoot_975= xBoot(n975)                 ; 97.5% level

These are the significance levels given the distribution. If your original
sample exceeds the (say) '

xBoot_975' value it is significant at the 95.5% level.

You could calculate xBoot_950 for the 95% level.

===


On Wed, Dec 14, 2016 at 9:13 PM, Anahita Amiri Farahani <aamir003 at ucr.edu>
wrote:

> Why this one is wrong to calculate the significance level when there is
> only one partial derivative? and if this is wrong how can I calculate that
> it is significant or not?
>
> And based on this:
>
>    nBoot =   10000
>    xBoot = *new* <http://www.ncl.ucar.edu/Document/Functions/Built-in/new.shtml> (nBoot, typeof(F))
>
>    do ns=0,nBoot-1                        ; generate multiple estimates
>       iw = *generate_sample_indices* <http://www.ncl.ucar.edu/Document/Functions/Contributed/generate_sample_indices.shtml>(N,*1*))  ; indices with replacement
>       xBoot(ns) = (dF(iw)/dN(iw))*(dN(iw)/dA(iw))
>    end do
>
>
> How can I say if it is significant?
>
>
> Thanks,
>
> Ana
>
>
> On Wed, Dec 14, 2016 at 7:58 PM, Dennis Shea <shea at ucar.edu> wrote:
>
>> [1]
>> http://www.ncl.ucar.edu/Applications/bootstrap.shtml
>> http://www.ncl.ucar.edu/Document/Functions/Bootstrap/bootstr
>> ap_regcoef.shtml
>> Look at examples
>> bootstrap_regcoef_1.ncl
>> bootstrap_regcoef_2.ncl
>> bootstrap_regcoef_3.ncl
>>
>> [2]
>> You don't need the following but it was wrong. FTR:
>>
>> do k=0,2999
>>     ab  = regCoef(AI_fall(:,k),Nd_fall(:,k))
>>     df   = ab at nptxy-2
>>     tval = ab at tval
>>
>>     df     = where(df.lt.1,1, df)
>>     prob = 1 - betainc(df/(df+tval^2), df/2.0, 0.5)
>>     sig_fall(k) = where(prob.lt.0.95, -999, prob)
>> end do
>>
>> On Wed, Dec 14, 2016 at 7:02 PM, Anahita Amiri Farahani <aamir003 at ucr.edu
>> > wrote:
>>
>>> Thanks a lot, your answer was really helpful and I have another
>>> question:
>>>
>>> Before I use regCoef function in NCL to calculate linear regression.
>>> Using this function gives other variables such as rcraw_npt, and
>>>  rcraw_tval, so I was able to calculate significance at 95%, 90% and 99%
>>> confidence level. I've put that part of the code here:
>>>
>>> do k=0,2999
>>>
>>>    ab = regCoef(AI_fall(:,k),Nd_fall(:,k))
>>>     rcraw_npt=ab at nptxy-2
>>>     rcraw_tval=ab at tval
>>>     b    = rcraw_tval
>>>     b    = 0.5
>>>     rcraw_npt=where(rcraw_npt.lt.1,1,rcraw_npt)
>>>     rcraw_prob = (1 - betainc(rcraw_npt/(rcraw_npt+rcraw_tval^2),rcraw_npt/2.0,b)
>>> )
>>>     sig_fall(k)=where(rcraw_prob.lt.0.95,-999,rcraw_prob)
>>>
>>> end do
>>>
>>>
>>> How can I calculate the significance at different confidence level here
>>> by using xBoot?
>>>
>>> Best,
>>> Ana
>>>
>>>
>>>
>>>
>>> On Wed, Dec 14, 2016 at 2:45 PM, Dennis Shea <shea at ucar.edu> wrote:
>>>
>>>> I think you will have to decide what is best.
>>>>
>>>> [a]
>>>> Constrain the F,N,A triplets to be 'coupled'
>>>>
>>>>    nBoot =   10000
>>>>    xBoot = *new* <http://www.ncl.ucar.edu/Document/Functions/Built-in/new.shtml> (nBoot, typeof(F))
>>>>
>>>>    do ns=0,nBoot-1                        ; generate multiple estimates
>>>>       iw = *generate_sample_indices* <http://www.ncl.ucar.edu/Document/Functions/Contributed/generate_sample_indices.shtml>(N,*1*))  ; indices with replacement
>>>>       xBoot(ns) = (dF(iw)/dN(iw))*(dN(iw)/dA(iw))
>>>>    end do
>>>>
>>>> [b]
>>>>
>>>> Unconstrained
>>>>
>>>>
>>>>    nBoot =   10000
>>>>    xBoot = *new* <http://www.ncl.ucar.edu/Document/Functions/Built-in/new.shtml> (nBoot, typeof(F))
>>>>
>>>>    do ns=0,nBoot-1                        ; generate multiple estimates
>>>>       iwF = *generate_sample_indices* <http://www.ncl.ucar.edu/Document/Functions/Contributed/generate_sample_indices.shtml>(N,*1*)) ; indices with replacement
>>>>       iwN = *generate_sample_indices* <http://www.ncl.ucar.edu/Document/Functions/Contributed/generate_sample_indices.shtml>(N,*1*))
>>>>       iwA = *generate_sample_indices* <http://www.ncl.ucar.edu/Document/Functions/Contributed/generate_sample_indices.shtml>(N,*1*))
>>>>
>>>>       xBoot(ns) = (dF(iwF)/dN(iwN))*(dN(iwN)/dA(iwA))
>>>>    end do
>>>>
>>>> [c]
>>>> See where your product fits.
>>>>
>>>>    ia = *dim_pqsort_n* <http://www.ncl.ucar.edu/Document/Functions/Built-in/dim_pqsort_n.shtml>(xBoot, 2, 0)        ; sort bootstrap means into ascending order
>>>>
>>>>    n025     = *round* <http://www.ncl.ucar.edu/Document/Functions/Built-in/round.shtml>(0.025*(nBoot-1),3)    ; indices for sorted array
>>>>    n500     = *round* <http://www.ncl.ucar.edu/Document/Functions/Built-in/round.shtml>(0.500*(nBoot-1),3)
>>>>    n975     = *round* <http://www.ncl.ucar.edu/Document/Functions/Built-in/round.shtml>(0.975*(nBoot-1),3)
>>>>
>>>>    xBoot_025= xBoot(n025)                 ;  2.5% level
>>>>    xBoot_500= xBoot(n500)                 ; 50.0% level  (median)
>>>>    xBoot_975= xBoot(n975)                 ; 97.5% level
>>>>
>>>>
>>>>
>>>> On Wed, Dec 14, 2016 at 3:12 PM, Anahita Amiri Farahani <
>>>> aamir003 at ucr.edu> wrote:
>>>>
>>>>> Dear all,
>>>>>
>>>>> I have a product of two partial derivatives : dF/dN*dN/dA and for each
>>>>> of the variables (F, N, and A) I have data for 720 times. Each partial
>>>>> derivatives are calculated  by linear regression. I was wondering how I can
>>>>> calculate the significant test for this product. All examples in NCL to
>>>>> estimate linear regression by this function: *regline_stats
>>>>> <http://www.ncl.ucar.edu/Document/Functions/Contributed/regline_stats.shtml> *
>>>>> give the regression coefficient for two variables.
>>>>>
>>>>> Thanks,
>>>>> Ana
>>>>>
>>>>> _______________________________________________
>>>>> ncl-talk mailing list
>>>>> ncl-talk at ucar.edu
>>>>> List instructions, subscriber options, unsubscribe:
>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>
>>>>>
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20161215/fcb1c3f7/attachment.html 


More information about the ncl-talk mailing list