Biology, images, analysis, design...
Use/Abuse Principles How To Related
"It has long been an axiom of mine that the little things are infinitely the most important" (Sherlock Holmes)

Search this site



Just a note

There are of course any number of other ways of calculating this statistic,
    For example:
  • cov(x,y)/(sd(x)*sd(y))
  • cov(x,y)/sqrt(var(x)*var(y))
  • cov(x/sd(x),y/sd(y))

    But these cannot deal with missing (NA) values.

  • cor.test(x,y)
    works when x &/or y includes NA values, but for simulations it is relatively slow.
You could remove NA values from x & y, beforehand, with these instructions| x=x[-na]; y=y[-na]; rm(na)