Attachment 'tp.py'
Download 1 #!/usr/bin/python
2 import numpy as np
3 import scipy.stats,math
4 # Time series of JJA rainfall anomalies in magenta box in La Nina years.
5 # Units are 0.1 mm
6 # area fraction of box, compared to whole domain: f=0.048
7 d=[1520.95864484, -1358.54014118, -609.558987003, -1181.48614309, -496.757418015,
8 -1019.90448597, 85.1424898604, -239.607945636, 30.852401201, 137.252540747,
9 136.709073591, -519.553083375, -838.162447148, -236.213575834, 295.318167041]
10 da=np.array(d)
11 n=da.shape[0]
12 tval=math.sqrt(1.*n)*da.mean(0)/np.sqrt(da.var(0))
13 print 'n=',n
14 print 'my t-value:',tval
15 scipytvalue,scipypvalue=scipy.stats.ttest_1samp(da,0.)
16 print 'scipytvalue',scipytvalue
17 print 'scipypvalue',scipypvalue,'(this is 2*p)'
18 print 'Note discrepancy in t-values, I must be doing something wrong :('
19 # approximately confirms at: http://danielsoper.com/statcalc3/calc.aspx?id=8
20
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.- [get | view] (2012-06-26 20:19:37, 41.8 KB) [[attachment:JASOindices.png]]
- [get | view] (2012-06-27 10:57:17, 44.4 KB) [[attachment:JASOindicesD.png]]
- [get | view] (2012-06-26 20:20:36, 55.0 KB) [[attachment:JJAindices.png]]
- [get | view] (2012-06-13 19:21:44, 79.9 KB) [[attachment:elnino.jja.precip.gif]]
- [get | view] (2012-06-14 15:47:34, 264.6 KB) [[attachment:jjad1950.png]]
- [get | view] (2012-06-13 22:25:10, 202.0 KB) [[attachment:jjarain.png]]
- [get | view] (2012-06-13 22:26:08, 219.5 KB) [[attachment:jjarainpercent.png]]
- [get | view] (2012-06-13 22:27:27, 314.8 KB) [[attachment:jjatvalue.png]]
- [get | view] (2012-06-13 19:21:07, 79.6 KB) [[attachment:lanina.jja.precip.gif]]
- [get | view] (2012-06-13 22:25:39, 187.0 KB) [[attachment:laninajjachange.png]]
- [get | view] (2012-06-14 13:49:59, 169.8 KB) [[attachment:laninajjachangeINSET.png]]
- [get | view] (2012-06-15 19:18:45, 74.6 KB) [[attachment:nino3nino4.png]]
- [get | view] (2012-06-26 16:46:43, 30.2 KB) [[attachment:rainbar.png]]
- [get | view] (2012-06-14 17:41:57, 1.1 KB) [[attachment:rainbox.txt]]
- [get | view] (2012-06-13 22:31:30, 0.8 KB) [[attachment:tp.py]]
You are not allowed to attach a file to this page.