- 积分
- 4314
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2015-5-27
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
求助:
进行回归分析后,用betainc函数进行了显著性检验。在用阴影方式绘制回归系数时,图像没有问题,但是改用等值线时,出现了等值线交叉的情况,两次绘图的差别只是将FillOn改成了False,LineOn改成了True。不知道是怎么回事,还是哪里计算的问题...还有通过显著性检验的区域特别大,有点儿不是很确定,不知道是不是betainc函数的使用有问题还是绘图的问题,希望能得到帮助~
脚本如下:
rc = regCoef_n(eofts,hgtDJF(:,:,:),0,0) ;_n choose the element
rc2 = regCoef_n(eofts2,hgtDJF(:,:,:),0,0)
; printVarSummary(rc) ;the results have to be defined
rc!0 = "lat"
rc&lat = hgtDJF&lat
rc!1 = "lon"
rc&lon = hgtDJF&lon
rc2!0 = "lat"
rc2&lat = hgtDJF&lat
rc2!1 = "lon"
rc2&lon = hgtDJF&lon
copy_VarCoords(hgtDJF(:,:,:), rc) ; copy lat,lon coords
copy_VarCoords(hgtDJF(:,:,:), rc2)
rc@long_name="regression coefficient"
rc2@long_name="regression coefficient"
printVarSummary(rc)
printVarSummary(rc2)
;-------------------------------------------------------
;test
;-------------------------------------------------------
tval = onedtond(rc@tval , dimsizes(rc)) ;t-statistic of rc
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)
prob!0 = "lat" ; name dimensions
prob!1 = "lon"
prob&lat = hgtDJF&lat ; assign coordinate values to named dimensions
prob&lon = hgtDJF&lon
prob@long_name="probability"
printVarSummary(prob)
;***************
;rc2
;------------------------------------------------------------------
tval2 = onedtond(rc2@tval , dimsizes(rc2)) ;t-statistic
df2 = onedtond(rc2@nptxy, dimsizes(rc2)) - 2 ;自由度
b2 = tval2 ; b must be same size as tval (and df)
b2 = 0.5
prob2 = betainc(df2/(df2+tval2^2),df2/2.0,b2) ; prob(nlat,nlon)
prob2!0 = "lat" ; name dimensions
prob2!1 = "lon"
prob2&lat = hgtDJF&lat ; assign coordinate values to named dimensions
prob2&lon = hgtDJF&lon
prob2@long_name="probability"
printVarSummary(prob2)
; print(prob2)
;-------------------------------------------------
; plot
;-------------------------------------------------
wks = gsn_open_wks("pdf","/pic/regressof200color")
gsn_define_colormap(wks,"GMT_Gray")
res = True
res@gsnDraw = False
res@gsnFrame = False
res@cnFillOn = True
res@cnLinesOn = False
res@lbLabelBarOn = True
res@gsnAddCyclic = True
res@cnLineLabelsOn = True
res@lbOrientation = "Vertical"
res@lbBoxLinesOn = False
res@gsnContourNegLineDashPattern = 1 ; sets negative contours to dash pattern 1
res@cnLineThicknessF = 0.6
res@cnLineLabelFontHeightF = 0.008
res@cnLineLabelFontThicknessF = 0.005
res@tmXBLabelFontHeightF = 0.015
res@tmYLLabelFontHeightF = 0.015
; res@gsnSpreadColors = True ; use full colormap
;************************************************
; Smoothing
;************************************************
res@cnSmoothingOn = True
res@cnSmoothingDistanceF = 0.001
res@cnSmoothingTensionF = -2
;---map range
res@mpCenterLonF = 180
res@mpMinLatF = 0
res@mpMaxLatF = 90
res@mpMinLonF = 0
res@mpMaxLonF = 360
res@gsnRightString = ""
res@gsnLeftString = ""
res@cnInfoLabelOn=False
plots = new(2,graphic)
res@tiMainString = "regression of PC1&hgt200"
plots(0) = gsn_csm_contour_map(wks,rc,res)
res@tiMainString = "regression of PC2&hgt200"
plots(1) = gsn_csm_contour_map(wks,rc2,res)
pres = True
pres@gsnMaximize = True
; pres@gsnPanelRowSpec = True
pres@gsnPanelLabelBar = False
pres@lbBoxLinesOn = False
res2 = True
res2@gsnDraw = False
res2@gsnFrame = False
res2@cnFillOn = True
res@cnLinesOn = False
res2@cnLineLabelsOn = False
res2@cnInfoLabelOn = False
res2@lbLabelBarOn = False
res2@cnMonoFillPattern = False
res2@cnLevelSelectionMode = "ExplicitLevels"
res2@cnLevels = (/0.05/) ;; set to significance level
res2@cnFillPatterns = (/17,-1/)
res2@cnFillColors = (/1,0/)
res2@gsnLeftString = ""
plot1 = gsn_csm_contour(wks,prob,res2)
plot2 = gsn_csm_contour(wks,prob2,res2)
overlay(plots(0),plot1)
overlay(plots(1),plot2)
gsn_panel(wks,plots,(/2,1/),pres)
end
|
-
-
|