- 积分
- 2648
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2013-5-22
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
我用regCoef对nino3指数与sst做了相关,并用betainc检验(官网的解释是t检验的一种:The returned probability is two-tailed. The ttest uses the incomplete beta function (betainc) to calculate the probability. Example 2 at betainc illustrates how to get the one-tailed probability. There is also a link where you can get one and two-tailed probabilities via the WWW.)
因为对betainc 这个函数不是很理解,所以图画出来怪怪的,也不知道怎么改~(比如:Example 2 - The betainc can be used as a p-Value calculator for the Student t-test. Let's say a calculation has been made where the degrees-of-freedom (df=20) and a Student-t value of 2.08 has been determined. A probability level may be determined via:
df = 20 tval = 2.08 prob = betainc( df/(df+tval^2), df/2.0, 0.5) print ("prob="+prob)) 这里的0.5是默认还是……?
想显示通过95%显著性检验的地方,应该如何修改程序呢?
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
;************************************************
begin
time=45
nx=360
ny=180
missing_value=-1.0E+30
lat = fspan(-89.5,89.5,180)
lon = fspan(-179.5,179.5,360)
lat@units = "degrees_north"
lon@units = "degrees_east"
x=fbindirread("winter.grd",0,(/time/),"float")
x!0="time"
y=fbindirread("djf.grd",0,(/time,ny,nx/),"float")
y!0="time"
y!1="lat"
y!2="lon"
y&lat=lat
y&lon=lon
printVarSummary(y)
rc = regCoef(x, y(lat|:,lon|:,time|:) )
rc!0 = "lat" ; name dimensions
rc!1 = "lon"
rc&lat = y&lat ; assign coordinate values to named dimensions
rc&lon = y&lon
printVarSummary(rc) ; variable overview
tval = onedtond(rc@tval , dimsizes(rc)) ;t-statistic
df = onedtond(rc@nptxy, dimsizes(rc)) - 2 ;自由度
b = tval ; b must be same size as tval (and df)
b = 0.5
prob = betainc(df/(df+tval^2),df/2.0,b) ; prob(nlat,nlon)
;print(prob)
prob!0 = "lat" ; name dimensions
prob!1 = "lon"
prob&lat = y&lat ; assign coordinate values to named dimensions
prob&lon = y&lon
rc@long_name = "regression coefficient"
prob@long_name = "probability"
wks = gsn_open_wks("x11","regression")
gsn_define_colormap(wks,"BlWhRe")
res = True
res@gsnDraw = False
res@gsnFrame = False
res@cnInfoLabelOn = False
res@cnFillOn = True
res@cnLineLabelsOn = False
res@gsnSpreadColors = True
res@lbLabelBarOn = False
res@tiMainString = ""
res@gsnRightString = ""
res@cnLevelSelectionMode = "ManualLevels"
res@cnMinLevelValF = -2.
res@cnMaxLevelValF = 2.
res@cnLevelSpacingF = 0.2
res@mpCenterLonF = 180
plot1 = gsn_csm_contour_map_ce(wks,rc,res)
res2 = res
res2@gsnDraw = False ; do not draw
res2@gsnFrame = False ; do not advance frame
res2@gsnMaximize = True
res2@cnMonoFillPattern = False
res2@cnLevelSelectionMode = "ExplicitLevels"
res2@cnLevels = (/b/) ;; set to significance level
res2@cnFillPatterns = (/3/)
res2@gsnLeftString = ""
plot3 = gsn_csm_contour(wks,prob,res2)
overlay(plot1,plot3)
end
|
|