Re: error in canonical correlation analysis (CCA)

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Fri Apr 16 2010 - 14:01:36 MDT

Stone,

Can you email me your two ASCII files so I can run your script?

--Mary

On Apr 13, 2010, at 9:57 PM, <sidong7041@hotmail.com>
<sidong7041@hotmail.com> wrote:

> Hi there,
> I am performing a canonical correlation analysis with the cancor
> routine.
> The two fields is SST( 158,55) and rain( 156,55).
> however, I got the following incorrect results. The output canr
> value is incorrect (large than 1.0).
>
>
> Thanks a lot in advance,
>
> --Stone
> ----------------------------------------------------------------------
> ----
> The output :
> canr
> Dimensions and sizes: [156]
> Coordinates:
> Number Of Attributes: 5
> ndof : <ARRAY of 156 elements>
> coefy : <ARRAY of 24336 elements>
> coefx : <ARRAY of 24648 elements>
> wlam : <ARRAY of 156 elements>
> chisq : <ARRAY of 156 elements>
> (0) 177156.9
> (1) 143534.9
> (2) 126688.5
> (3) 118556.6
> (4) 111030.6
> (5) 106364
> (6) 97091.65
> (7) 96355.91
> (8) 90402.44
> (9) 85798.05
> (10) 81377.4
> (11) 80841.88
> (12) 77203.06
> (13) 73328.29
> (14) 71752.25
> (15) 67675.48
> (16) 65583.56
> (17) 65149.32
> (18) 61743.71
> (19) 59880.7
> (20) 56873.12
> (21) 55540.66
> (27) 46672.02
> (28) 45966.54
> (29) 45708.81
> (30) 44472.45
> (31) 42724.57
> (32) 42007.14
> (33) 41123.85
> (34) 39644.17
> (35) 38480.35
> (36) 36747.88
> (37) 36268.79
> (38) 34981.12
> (39) 33899.27
> (40) 32424.7
> (41) 31713.69
> (42) 30990.04
> (43) 30100
> (44) 28837.65
> (45) 28029.51
> (46) 26931.78
> (47) 25153.13
> (48) 24904.98
> (49) 23888.79
> (50) 23311.97
> (51) 22239.48
> (52) 20958.73
> (53) 19483.88
> (54) 55.60012
> (55) 43.17431
> (56) 40.45679
> (57) 37.83539
> (58) 34.2077
> (59) 33.30375
> (60) 30.14031
> (61) 28.53269
> (62) 28.05641
> (63) 26.14609
> (64) 24.2809
> (65) 23.80275
> (66) 20.61175
> (67) 19.54397
> (68) 18.97411
> (69) 17.43671
> (70) 16.92381
> (71) 14.8029
> (72) 14
> (73) 13.2647
> (74) 12.197
> (75) 11.47018
> (76) 8.760074
> (77) 6.609896
> (78) 0
> (79) 0
> (80) 0
> (81) 0
> (82) 0
> (83) 0
> (84) 0
> (85) 0
> (86) 0
> .
> .
> .
> ----------------------------------------------------------------------
> -------------
> The NCL script:
> ;*********************************************
> load "/cygdrive/E/cygwin/usr/local/lib/ncarg/nclscripts/csm/
> gsn_code.ncl"
> load "/cygdrive/E/cygwin/usr/local/lib/ncarg/nclscripts/csm/
> gsn_csm.ncl"
> load "/cygdrive/E/cygwin/usr/local/lib/ncarg/nclscripts/csm/
> contributed.ncl"
> load "/cygdrive/E/cygwin/usr/local/lib/ncarg/nclscripts/csm/
> shea_util.ncl"
> begin
> ;********************************************************
> filename1 = "/cygdrive/E/cygwin/home/stone/sst_filter_158point.asc"
> filename2 = "/cygdrive/E/cygwin/home/stone/JJA_53-07_156point.asc"
> ;**************************************************************
> data1 = asciiread(filename1,(/158,55/),"float")
> data2 = asciiread(filename2,(/156,55/),"float")
> sst = new((/158,55/),float)
> rain = new((/156,55/),float)
> sst(:,:) = data1(:,:)
> rain(:,:)= data2(:,:)
>
> print("apply CCA method..")
> opt=False
> canr=cancor(sst,rain,opt)
> print("calculate propability")
> ;prob=gammainc(0.5*canr@chisq, 0.5*canr@ndof)
>
> print("output CCA")
> print(canr)
> ;print(canr@ndof)
> ;print(prob)
> end
> --------------------------------------------------
> ----------------------------------------------------------------------
> ----------------
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Apr 16 14:01:59 2010

This archive was generated by hypermail 2.1.8 : Fri Apr 16 2010 - 16:21:29 MDT