Re: about CCA

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Thu Oct 22 2009 - 13:51:41 MDT

Yes, the output is "strange". However, based on the code snippet
I am not sure what the problem might be.

FYI: you do not have to standardize the data prior to use of cancor.
Weighting is certainly not the issue.
===
You can ftp the full script and data to:

ftp ftp.cgd.ucar.edu
anonymous
Use your email address for the password
cd incoming
put ...
put ...
   :
quit

Send us an email <mailto:ncladmin@ucar.edu,shea@ucar.edu> with the
following information:

    * The names of the files after you have successfully completed the
      transfer.
      We cannot look at the ftp/incoming directory for security reasons.
    * The version of NCL you are running (ncl -V).
    * The type of system you are on (uname -a).

Stergios Misios wrote:
> hi all,
> i try to perform canonical correlation analysis with the cancor routine.
> what i am doing is to read the two fields, to standardize to reshape
> from (time,lev,lat) to (time,lev*lat) and finally to apply cancor.
> briefly a code snippet,
> ==============================================
> ;standarize
> ;----------
> print("standarize matrices...")
> pw_std=dim_standardize_n(pw,1,0)
> uw_std=dim_standardize_n(uwind,1,0)
>
> ;reshape arrays
> ;--------------
> print("Reshape matrices")
> do itime=0,ntime_pw-1
> trans_pw(:,itime)=ndtooned(pw_std(itime,:,:))
> trans_uw(:,itime)=ndtooned(uw_std(itime,:,:))
> end do
>
> ;release memory
> ;-------------
> delete(pw_std)
> delete(uw_std)
>
> ; compute CCA vector
> ;-------------------
> print("Predictor XBs:"+nlev_pw*nlat_pw)
> print("Predictand YBs:"+nlev_uw*nlat_uw)
> print("apply CCA method...")
>
>
> opt=False
> ccam=cancor(trans_pw,trans_uw,opt)
> print("End...")
> print(ccam)
> =========================================
> the output i must say is very strange,
>
> Variable: ccam
> Type: float
> Total Size: 816 bytes
> 204 values
> Number of Dimensions: 1
> Dimensions and sizes: [204]
> Coordinates:
> Number Of Attributes: 5
> ndof : <ARRAY of 204 elements>
> coefy : <ARRAY of 41616 elements>
> coefx : <ARRAY of 48960 elements>
> wlam : <ARRAY of 204 elements>
> chisq : <ARRAY of 204 elements>
> (0) 111823
> (1) 87949.13
> (2) 62144.38
> (3) 50775.16
> (4) 40324.11
> (5) 36114.61
> (6) 27940.67
> (7) 25172.04
> (8) 22960.51
> (9) 19126.69
> (10) 18376.85
> (11) 16603.9
> (12) 15086.54
> (13) 14262.58
> (14) 12602.33
>
> This i guess it is suppoded to be the correlation coefficients and must
> be <1. where am i wrong?
> i guess also i must weight the values but i left it for later...
> please find attached the script...
>
> Thank you in advance,
> stergios
>
>
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
======================================================
Dennis J. Shea                  tel: 303-497-1361    |
P.O. Box 3000                   fax: 303-497-1333    |
Climate Analysis Section                             |
Climate & Global Dynamics Div.                       |
National Center for Atmospheric Research             |
Boulder, CO  80307                                   |
USA                        email: shea 'at' ucar.edu |
======================================================
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Oct 22 13:51:40 2009

This archive was generated by hypermail 2.1.8 : Mon Oct 26 2009 - 15:01:33 MDT