[R] correlation tab

(Ted Harding) ted.harding at nessie.mcc.ac.uk
Fri Apr 27 12:20:06 CEST 2007


On 27-Apr-07 09:38:55, elyakhlifi mustapha wrote:
> hello,
> I know how to use the function "cor" to do correlation frame
> but it remains a problem because  I wanna calculate correlation
> between vector with differents dimensions it is possible?
>  for exemple my data :
> 
>> V
> [[1]]
>  [1]  97 104 103  98  99  92  99  99  98  87  95 101  91 104
>       98  96  84  97  92 104  97
> [[2]]
>  [1] 102 100  82 106  85  97 101  99  90 101  97  93 100  99
>       92  90 102  94  99 104
> [[3]]
>  [1]  98  95 104  96 104  86 100  91  94  95  99 100  95  95
>      104  98  97  99  94 100  94
> 
> length(V[[1]]) =  length(V[[3]]) = 21 but length(V[[2]]) = 20

Correlation only makes sense in a context where each element of
one vector used in the correlation is associated with a single
corresponding element of the other vector (think in terms of
simulataneous observations of different variables on an item:
so for instance V1[1] would be the obversevation of variable V1
on item 1, V2[1] the observation of variable V2 on item 1, etc.;
so V1[i], V2[i] and V3[i] are the observations of variables
V1, V2, V3 on item i).

So now it is up to you to identify what the association is
between the elements of your V[[1]], V[[2]] and V[[3]].

It may be that your "short" vector V[[2]] is simply missing
an observation on one item. In which case, the simplest approach
is to omit the corresponding element from V[[1]] and V[[3]],
and calculate the correlation from the remainder, assuming of
course that their elements are indeed associated in the way
described above.

Hoping this helps,
Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 27-Apr-07                                       Time: 11:19:40
------------------------------ XFMail ------------------------------



More information about the R-help mailing list