File:Spurious Correlation (Colour).svg

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
Original file (SVG file, nominally 540 × 540 pixels, file size: 160 KB)

Summary

Description
English: An illustration of spurious correlation as defined by Karl Pearson in Mathematical Contributions to the Theory of Evolution—On a Form of Spurious Correlation Which May Arise When Indices Are Used in the Measurement of Organs, Proceedings of the Royal Society of London, 1897, volume 60, pages 489-498, https://www.jstor.org/stable/115879)

Source code

The logo of R – programming language for statistical analysis
The logo of R – programming language for statistical analysis
This media was created with R (programming language for statistical analysis)
Here is a listing of the source used to create this file.

Deutsch  English  +/−

require(ggplot2)
set.seed(5)

n.obs <- 500
xyz.df <- data.frame(
  x=rnorm(n.obs, mean=10, sd=1),
  y=rnorm(n.obs, mean=10, sd=1),
  z=rnorm(n.obs, mean=30, sd=3)
)

xyz.df <- transform(
  xyz.df,
  x.over.z= x/z,
  y.over.z= y/z
)
ggplot(data=xyz.df, aes(y=x.over.z, x=y.over.z)) +
  geom_point(aes(colour=z)) +
  scale_colour_gradient2(midpoint=median(xyz.df$z)) +
  labs(y="x/z", x="y/z") + 
  annotate(
    "text", x= 0.2, y=0.6, hjust=0, vjust=1, parse=TRUE, size=10,
    label=sprintf(" rho == %0.2f", with(xyz.df, cor(x.over.z,y.over.z)))
  ) +
  theme(legend.justification=c(1,0), legend.position=c(1,0)) +
  coord_equal(xlim=c(0.18,0.62), ylim=c(0.18,0.62))

ggsave("spuriousCorrelationColour.svg", height=6, width=6)
Date
Source Own work
Author David Lovell (Lov090)
SVG development
InfoField
 The SVG code is valid.
 This trigonometry was created with R.

Licensing

David Lovell (Lov090), the copyright holder of this work, hereby publishes it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

10 January 2014

image/svg+xml

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current00:26, 10 January 2014Thumbnail for version as of 00:26, 10 January 2014540 × 540 (160 KB)wikimediacommons>Lov090User created page with UploadWizard

The following page uses this file:

Metadata