Hi -
That does make sense that if the two variables are not on the same
grid, then the operations wouldn't be symmetric.
You could also use Ferret to regrid the one of the two variables to the
grid of the other, with a regridding transformation:
let p1 = isorama
let q = isoairs
let p = p1[g=q]
go regresst
Ms Sindu Raj Parampil wrote:
Hello Ansley,
Thank you for the suggestion. I listed the different variables used in
calculation of correlation from both cases.
Variance.jnl calculates CORREL= COVAR / (P_VAR_MASK*Q_VAR_MASK)^.5
For case 1 (i.e., p = isoairs, q = isorama and correl = 0.2269),
COVAR = 0.4739, P_VAR_MASK = 1.506, Q_VAR_MASK = 2.897
For case 2 (i.e., p = isorama, q = isoairs and correl = undefined),
COVAR = 0.4551, P_VAR_MASK = 2.931, Q_VAR_MASK = 1.504
So case 2 does have values upto the penultimate step. Yet,
its not calculating the correlation. When these values are
manually plugged in the _expression_,
CORREL= COVAR / (P_VAR_MASK*Q_VAR_MASK)^.5
the CORREL = 0.2168. This is still different from CORREL case 1 (0.2269).
Meanwhile a friend mentioned that the different grids of variables
(isoairs, isorama) could be reasponsible for the different CORRELs. So I
wrote the variables out into a text file and read them onto the same grid.
This solved the problem and now both CORRELs match!
thanks and regards
Sindu
On Thu, 17 Sep 2009, Ansley Manke wrote:
Hi Sindu,
Yes, the correlation should be the same when p and q are reversed, and a
simple test I just tried does result in the same correl regardless of
which variable is P and which is Q. Something odd seems to be happening
with your data.
One thing to try is after the first command
let p = isorama[k=1]; let q = isoairs[k=1]; go variance ; li correl
then do "cancel variable/all; cancel memory", before
let p = isoairs[k=1]; let q = isorama[k=1]; go variance ; li correl
which will make sure that the data is read again and everything is
reinitialized. I don't really know that this will make any difference.
If the result of the second definitions is still missing, to try to find
out what might be going on, you could look at the variables that are
defined by the variance.jnl script:
yes? go variance
yes? go/help variance ! lists the commands in the script
Then just list or plot the values of the different variables that are
defined as the script builds up the definition of correl. For instance
list p_ave, q_ave
list p_dev, q_dev ! or plot p_dev, q_dev
and so forth. This may show that one variable has lots of missing data,
perhaps, or some other peculiar behavior that's causing this.
Please write back and let us know what you find out.
Ansley
Ms Sindu Raj Parampil wrote:
Hello,
I've encountered a problem while calculating correlation using the
'variance.jnl' between 2 variables: isorama and ISOAIRS.
When I choose p = isorama & q = isoairs to run variance.jnl, the
correlation coefficient is 0.2269. But when p and q are reversed
(i.e., p = isoairs & q = isorama ), the correlation is undefined.
Shouldn't the corr. coeffs be same irrespective of the order of the
variables for simultanoeus correlation?
Pls see below for the commands I used in both cases and the ferret
calculations.
1) let p = isorama[k=1]; let q = isoairs[k=1]; go variance ; li correl
VARIABLE : CORRELATION OF P AND Q
FILENAME : RH_1s90e_03_04.nc
LONGITUDE: 90E
LATITUDE : 1.5S
DEPTH (m): -3
TIME : 31-DEC-2002 12:00 to 08-JUN-2004 12:00
0.2269
2) let p = isoairs[k=1]; let q = isorama[k=1]; go variance ; li correl
VARIABLE : CORRELATION OF P AND Q
FILENAME : RH_1s90e_03_04.nc
LONGITUDE: 89.5E
LATITUDE : 1.5S
HEIGHT (millibar): 1000
TIME : 31-DEC-2002 12:00 to 08-JUN-2004 12:00
....
I use FERRET v6.2 on OpenSuse 11.0. Any help is appreciated.
Thank you
Sindu
|