# [R] linear correlation?

dechao wang dechwang at yahoo.co.uk
Fri Mar 8 12:08:03 CET 2002

```Many thanks for all who have joined the discussion.
>From the instructive discussion, it seems there may
not have a command or function to deal with DIRECTLY
the comparison between two items, such as
x1<-c(weight1, ...weightn, height1,...heightn)
x2<-c(weight1, ...weightn, height1,...heightn)

However, this may be quite a common question in the
correlation analysis could be used to address this
issue, except that the resolution rate is not good.
According to the theory of gray systems, several
measures can be taken to increase the compatibility of
different items which contain different units and
measurements. Take trees for example, after the data
were normalised, the relation degree between tree1 and
tree2 is 0.9997, while the relation degree between
tree1 and tree3 is 0.4988.

> tree1<-c(1,  2,  3,   100, 200, 300)
> tree2<-c(1.1,2.8,3.3, 108, 209, 303)
> tree3<-c(3.8,6.8,5.3, 108, 209, 303)
> trees<-cbind(tree1,tree2,tree3)
> cor(trees,trees)
tree1     tree2     tree3
tree1 1.000000 0.9996549 0.9997620
tree2 0.999655 1.0000000 0.9999687
tree3 0.999762 0.9999687 1.0000000
>
> tree1<-c(tree1[1:3]/6.8, tree1[4:6]/303)
> tree2<-c(tree2[1:3]/6.8, tree2[4:6]/303)
> tree3<-c(tree3[1:3]/6.8, tree3[4:6]/303)
> trees<-cbind(tree1,tree2,tree3)
> cor(trees,trees)
tree1     tree2     tree3
tree1 1.0000000 0.9918951 0.4988191
tree2 0.9918951 1.0000000 0.5806924
tree3 0.4988191 0.5806924 1.0000000

__________________________________________________

Everything you'll ever need on one web page
from News and Sport to Email and Music Charts

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

```